This article is part of the Adobe Experience Platform Mobile SDKs mini-series. It is about enabling your app to handle deep links.
You can find the overview here.
For the article about debugging, we will need to use so-called “deep links”, i.e. links that when tapped on your phone, will open your app rather than your browser.
This article is about how to add that capability to your app.
I will say up front that I can only show you how to do this on Android. There are tutorials out there for iOS, but not having an iPhone nor a developer account for the App Store, I can’t say how good they are.
Add Deep Link to your App
On Android, a lot of what your app can or should do is defined in the Manifest, AndroidManifest.xml
. In there, we define so-called “Intents“, and those Intents define “what our app feels responsible for” on the users’ phones, so to speak.
Our app will know which Intents it should react to because we define “Intent Filters” in AndroidManifest.xml
.
As usual, multiple ways lead to Rome. In this case, there is an App Links Assistant in Android Studio, or we can manually build everything.
Let’s keep this simple and use the App Links Assistant.
- Add URL intent filters
- Add logic to handle the intent
- Associate website
- Test on device or emulator
Start the process by clicking the “Open URL Mapping Editor” button, then click the little “+” symbol to add a mapping.
Once you Ok and close the dialog, you can type a URL into the field underneath, and the Mapping Editor will show you what Activity it would map to, if any.
Underneath, you can preview the changes that the assistant is making in your AndroidManifest.xml
onCreate()
method:
// ATTENTION: This was auto-generated to handle app links. Intent appLinkIntent = getIntent(); String appLinkAction = appLinkIntent.getAction(); Uri appLinkData = appLinkIntent.getData();
This is all the code that is needed here.
Move on to configuring your web server to understand your URLs by clicking the “Open Digital Asset Links File Generator” button:
For now, just click the “Generate Digital Asset Links file” button.
If you have done this before, you should add the lines in the preview into the existing file, instead.
Whichever way you do it, you can use the “Link and Verify” button to see if you did it right:
![[screenshot]](https://webanalyticsfordevelopers.files.wordpress.com/2020/02/200211-link-and-verify.png?w=656&h=200)
Testing
The final step in the Assistant is to test whether everything you have done so far actually works. You can test on your own phone. Connect it to your machine and enable debugging. Or you can test using an emulator, up to you.
Clicking the “Link and Verify” button opens a new dialogue, prepopulated with your server address.
Type the rest of your URL, then click the “Run Test” button.
The tester will show you which Activity is mapped to your URL.
Notes
You might wonder why we did this. Or why I chose to post this article, given that all I did was walk you through an assistant.
Point is, we will need deep links for the article about debugging with Project Griffon, and so I wanted to get it out of the way.
The important takeaway, for me, is that you need a publicly available web server.
Repeat: if you want to use Project Griffon, you need a publicly available web server!
And that’s why I’m posting this now. Giving you a week to sort out deep links.
Thank me later.
One thought on “Adobe Experience Platform Mobile SDKs – Deep Links (more setup)”