DifficultyMoeilijkheidsgraad: expert
Inhoud
Table of Contents | ||||
---|---|---|---|---|
|
Learning Objectives
After reading this article, you’ll be able to:
Set up deep links from 3rd party app to Workplace app
It is possible to launch Workplace App and navigate to specific screens/features in a single user action.
This behavior can be achieved by launching the URL either from a web application/website or from another app on the same device.
The linking mechanism is supported on the standard Workplace app, both on iOS and Android platforms.
What are deep links?
Deep links are predefined custom URLs, which can be used to invoke an app from an external app or environment. For example, selecting the “navigate” button on a website launches the default “maps” application on the device where navigation is started automatically.
Prerequisites
To activate an application which supports deep links, the following conditions must be ensured:
The destination app (in this case: The Workplace App) must be installed on the device
The source app must invoke the custom URL to trigger navigation
The deep link URL must be well formatted and pass all required parameters, as expected by the destination app.
Deep links in Workplace app
The Workplace app supports deep links to the below screens or features:
Book a room
View live floorplan
Deep-link construction format
The deep link is constructed out of 3 sections:
Scheme – The URL which is registered by an app. It informs the system that the app can handle links starting with this scheme.
Host – A unique identifier for the app/feature that you want to invoke. This is usable if multiple pages in an app handle the same Scheme.
Parameters – A list of key-value pairs, which can be captured by the application. Both keys and values should be of string type.
Leerdoelen
Na het lezen van dit artikel zul je in staat zijn om:
Deep links instellen van app van derden naar Workplace app
Het is mogelijk om Workplace App te starten en met één enkele gebruikersactie naar specifieke schermen/functies te navigeren.
Dit gedrag kan worden bereikt door de URL te starten vanuit een webapplicatie/website of vanuit een andere app op hetzelfde apparaat.
Het koppelingsmechanisme wordt ondersteund op de standaard Workplace app, zowel op iOS als Android platformen.
Wat zijn deep links?
Deep links zijn vooraf gedefinieerde aangepaste URL's die kunnen worden gebruikt om een app aan te roepen vanuit een externe app of omgeving. Als je bijvoorbeeld de knop "navigeren" selecteert op een website, wordt de standaardapplicatie "kaarten" gestart op het apparaat, waar de navigatie automatisch wordt gestart.
Vereisten
Om een toepassing te activeren die deeplinks ondersteunt, moet aan de volgende voorwaarden worden voldaan:
De app van bestemming (in dit geval: The Workplace App) moet geïnstalleerd zijn op het apparaat
De bron-app moet de aangepaste URL aanroepen om navigatie te activeren
De deep link URL moet goed geformatteerd zijn en alle vereiste parameters doorgeven, zoals verwacht door de bestemmingsapp.
Deep links in de Workplace app
De Workplace app ondersteunt deeplinks naar de onderstaande schermen of functies:
Boek een kamer
Bekijk live plattegrond
Bouwformaat met diepe verbinding
De deeplink bestaat uit 3 delen:
Regeling - De URL die is geregistreerd door een app. Hiermee wordt het systeem geïnformeerd dat de app links kan verwerken die beginnen met dit schema.
Gastheer - Een unieke identificatie voor de app/functie die je wilt aanroepen. Dit is bruikbaar als meerdere pagina's in een app hetzelfde schema afhandelen.
Parameters - Een lijst van key-value paren, die kunnen worden vastgelegd door de applicatie. Zowel de sleutels als de waarden moeten van het type string zijn.
Het formaat waarin deze zijn gestructureerd is:
PA://spacewell?targetview={0}&extraparam={1}&username={2}
WhereWaar,
Scheme Regeling = PA://
Host Gastheer = spacewell ruimteput
Parameters = targetview, extraparam and username
Host and Scheme
For now, both host and scheme should remain constant while creating deep links for integration with the Workplace app. The expected values are described above.
The Workplace app is designed in such a way that it can handle Scheme in both upper and lower case, as it is case sensitive.
Info |
---|
Make sure not to mix upper and lower case in the Scheme. |
Allowed
PA://…. OR pa://….
Not allowed
Pa://…. OR pA://….
Parameters
The following parameters are expected by Workplace app for enabling the use cases above.
Key
Purpose
Required
Details
targetview
The target screen to be launched via the deep link.
Yes
Should be one of the predefined 5 values, as described in the next chapter.
extraparam
For passing additional ID/value based on targetview
Optional
The allowed combinations of targetview and extraparam are described in the next chapter.
username
Workplace username or email ID of the user.
For an unauthenticated user, user identification is required in Workplace app: trigger the login flow.
For a logged in user, to ensure that the same user is authenticated across Workplace app and source app.
If email ID is used, the same email ID must be configured for the Workplace user.
No
When username is passed as a parameter:
For an unauthenticated user, Workplace app will capture the value and fill it on the username screen. It will automatically detect whether SSO is enabled for the user or not and trigger the relevant authentication flow.
It’s not possible to login with a different user in this case.
For a logged in user, Workplace app will capture the username and ensure that the same user is logged in. If not, the current user session will be terminated and login flow will be triggered for the user captured in the link.
When username is not passed as a parameter:
If no value is passed from the source app, the user comparisons are skipped in Workplace app.
For an unauthenticated user, the Workplace username should be entered manually in Workplace app as the first step. Any Workplace user is allowed to login.
On the other hand, an authenticated user with an active Workplace session in Workplace app can continue using the app when navigating from a deep link too. No user comparisons are made.
targetview and extraparam combinations
The below combinations of targetview and extraparam combinations are supported by Workplace app. If an incorrect value is passed for targetview, the Workplace app will show a relevant error message and navigate back to the launcher app. Back navigation is supported out of the box on Android only.
targetview
extraparam
Description
BOOK_ROOM
Not required
Navigates to “Book a room” screen where user can start searching for a room.
FLOORPLAN
Optional
To navigate to a live floorplan view.
With extraparam:
The floor ID (as per data received from Workplace APIs, see Rest API) should be passed as a parameter to launch the desired live floorplan without any explicit floor selection. The floor should be inside the current building selected in Workplace app.
Without extraparam:
When using this link for the first time, the user will be asked to select a floor from the available floors inside the current building. On subsequent launches, the previously selected floor will be remembered, and the live floorplan will be shown by default. The user still has a possibility to switch between the floors in the same building.
The previous selection will be cleared in the below scenarios:
A different user login in Workplace app
The current location (building) is changed in Workplace app
Examples
Launch “Book a room” screen
structureen gebruikersnaam
Gastheer en regeling
Voorlopig moeten zowel host als schema constant blijven tijdens het maken van deeplinks voor integratie met de Workplace app. De verwachte waarden zijn hierboven beschreven.
De Workplace app is zo ontworpen dat het zowel hoofdletters als kleine letters kan verwerken, omdat het hoofdlettergevoelig is.
Info |
---|
Zorg ervoor dat je geen hoofdletters en kleine letters door elkaar gebruikt in het schema. |
Toegestaan
PA://.... OF pa://....
Niet toegestaan
Pa://.... OF pA://....
Parameters
De volgende parameters worden verwacht door de Workplace app om de bovenstaande use cases mogelijk te maken.
Sleutel | Doel | Vereist | Details |
doelweergave | Het doelscherm dat moet worden gestart via de deeplink. | Ja | Moet een van de voorgedefinieerde 5 waarden zijn, zoals beschreven in het volgende hoofdstuk. |
extraparam | Voor het doorgeven van extra ID/waarde gebaseerd op targetview | Optioneel | De toegestane combinaties van targetview en extraparam worden beschreven in het volgende hoofdstuk. |
gebruikersnaam | Workplace gebruikersnaam of e-mailadres van de gebruiker. Voor een niet-geauthenticeerde gebruiker is gebruikersidentificatie vereist in de Workplace app: start de aanmeldingsstroom. Voor een ingelogde gebruiker, om ervoor te zorgen dat dezelfde gebruiker wordt geverifieerd in de Workplace app en de bron app. Als een e-mail-ID wordt gebruikt, moet dezelfde e-mail-ID worden geconfigureerd voor de Workplace-gebruiker. | Geen | Wanneer de gebruikersnaam als parameter wordt doorgegeven: Voor een ongeauthenticeerde gebruikerDe Workplace app vangt de waarde op en vult deze in op het gebruikersnaamscherm. Er wordt automatisch gedetecteerd of SSO is ingeschakeld voor de gebruiker en de relevante verificatiestroom wordt geactiveerd. In dit geval is het niet mogelijk om in te loggen met een andere gebruiker. Voor een ingelogde gebruikerDe Workplace app zal de gebruikersnaam vastleggen en controleren of dezelfde gebruiker is ingelogd. Als dat niet het geval is, wordt de huidige gebruikerssessie beëindigd en wordt de aanmeldingsstroom geactiveerd voor de gebruiker die is vastgelegd in de koppeling. Als de gebruikersnaam niet als parameter wordt doorgegeven: Als er geen waarde wordt doorgegeven vanuit de bron-app, worden de gebruikersvergelijkingen overgeslagen in de Workplace app. Voor een niet-geauthenticeerde gebruiker moet de Workplace gebruikersnaam als eerste stap handmatig worden ingevoerd in de Workplace app. Elke Workplace gebruiker mag inloggen. Aan de andere kant kan een geverifieerde gebruiker met een actieve Workplace sessie in de Workplace app de app ook blijven gebruiken wanneer hij vanuit een deeplink navigeert. Er worden geen gebruikersvergelijkingen gemaakt. |
targetview en extraparam combinaties
De onderstaande combinaties van targetview en extraparam worden ondersteund door de Workplace app. Als een onjuiste waarde wordt doorgegeven voor targetview, zal de Workplace app een relevante foutmelding tonen en terugnavigeren naar de launcher app. Terugnavigatie wordt alleen op Android out of the box ondersteund.
doelweergave | extraparam | Beschrijving |
BOEKENKAMER | Niet vereist | Navigeert naar het scherm "Boek een kamer" waar de gebruiker kan beginnen met het zoeken naar een kamer. |
PLATTEGROND | Optioneel | Om naar een live plattegrondweergave te gaan. Met extraparam: De vloer-ID (volgens gegevens ontvangen van Workplace API's, zie Rest API) moet worden doorgegeven als parameter om de gewenste live plattegrond te starten zonder expliciete vloerkeuze. De verdieping moet zich binnen het huidige gebouw bevinden dat is geselecteerd in de Workplace app. Zonder extraparam: Bij het eerste gebruik van deze link wordt de gebruiker gevraagd een verdieping te selecteren uit de beschikbare verdiepingen in het huidige gebouw. Bij volgende lanceringen wordt de eerder geselecteerde verdieping onthouden en wordt standaard de live plattegrond getoond. De gebruiker heeft nog steeds de mogelijkheid om te wisselen tussen de verdiepingen in hetzelfde gebouw. In de onderstaande scenario's wordt de vorige selectie gewist:
|
Voorbeelden
Hoe kan ik een Workplace app (
destination app) from a link in a source app?A deep link can be considered the same as a web URL, which means that it can be launched like any other web URL. It can be involved on click of a button, pasted in the device’s web browser (Chrome/Safari) or involved from a native iOS or Android app.
Shared below are some examples, which might help in implementing the logic in the source apps.
Xamarin iOS examplebestemmingsapp) activeren vanuit een link in een bronapp?
Een deeplink kan worden beschouwd als hetzelfde als een web URL, wat betekent dat het kan worden gelanceerd zoals elke andere web URL. De link kan worden gebruikt door op een knop te klikken, kan worden geplakt in de webbrowser van het apparaat (Chrome/Safari) of kan worden gebruikt vanuit een native iOS- of Android-app.
Hieronder staan enkele voorbeelden die kunnen helpen bij het implementeren van de logica in de bron-apps.
Xamarin iOS-voorbeeld
string url = string.Format("PA://spacewell?targetview={0}&extraparam={1}&username={2}", viewName, extraParamValue, userName);
UIApplication.SharedApplication.OpenUrl(new NSUrl(url));
Xamarin Android
example-voorbeeld
string url = string.Format("PA://spacewell?targetview={0}&extraparam={1}&username={2}", viewName, extraParamValue, userName);
Android.Net.Uri uri = Android.Net.Uri.Parse(url);
Intent intent = new nieuwe Intent(Intent.ActionView, uri);
StartActivityStartActiviteit(intentintentie);
Web/JavaScript
Using page redirectsPaginaomleidingen gebruiken
window.location.replace("PA://spacewell?targetview=FLOORPLAN&extraparam=0000012345&username=aaa");
Using aEen link gebruiken
<a href="PA://spacewell?targetview=FLOORPLAN&extraparam=0000012345&username=aaa">Floorplan<>Vloerplan</a>
How to navigate back to the source appHoe navigeer ik terug naar de bronapp?
Android
Back navigation Terugnavigatie in Android is supported wordt out-of-the-box . When a user navigates back from the Workplace app and the app was invoked from a deep link, Workplace app is dismissed, and the user can continue working on the previous app.
This offers a seamless navigation experience to the user.
iOS
On iOS platform, when an app is launched (Workplace app in this case), the launcher app is automatically dismissed to the background. Subsequently, back navigation to the previous app is not available out of the box.
If back navigation is required, the same deep linking mechanism can be used, but in the opposite direction. To enable this, the Workplace app will launch the source app (iOS app) via a deep link defined in the source app.
To enable this feature, most likely a development is required in the source iOS app; where Workplace app can trigger back navigation using the below URL scheme.
“pabacknavigation”
This can be achieved by implementing the below changes in the source iOS app:
In the AppDelegate, implement OpenURL method and return true.
In info.plist, add a custom URL scheme. It must be called “pabacknavigation”
If back navigation is not needed, the user will have to manually switch back to the source app after performing an operation in the Workplace iOS app.
Searchondersteund. Wanneer een gebruiker terugnavigeert vanuit de Workplace app en de app werd aangeroepen vanuit een deeplink, wordt de Workplace app verlaten en kan de gebruiker verder werken in de vorige app.
Dit biedt de gebruiker een naadloze navigatie-ervaring.
iOS
Op het iOS-platform wordt bij het starten van een app (in dit geval de Workplace-app) de launcher-app automatisch naar de achtergrond verplaatst. Vervolgens is terugnavigeren naar de vorige app niet direct beschikbaar.
Als terugnavigatie vereist is, kan hetzelfde deep linking mechanisme worden gebruikt, maar dan in omgekeerde richting. Om dit mogelijk te maken, zal de Workplace app de bron app (iOS app) starten via een deep link die is gedefinieerd in de bron app.
Om deze functie in te schakelen, is waarschijnlijk een ontwikkeling nodig in de iOS app als bron; de Workplace app kan de terug-navigatie activeren met behulp van het onderstaande URL-schema.
"pabacknavigation"
Dit kan worden bereikt door de onderstaande wijzigingen door te voeren in de iOS app als broncode:
Implementeer in de AppDelegate de methode OpenURL en retourneer true.
Voeg in info.plist een aangepast URL-schema toe. Het moet "pabacknavigation" heten.
Als terugnavigatie niet nodig is, moet de gebruiker handmatig terugschakelen naar de bron-app na het uitvoeren van een bewerking in de Workplace iOS app.
Zoek op
Live Search |
---|