Android initial setup
At a glance: The initial app setup enables the marketer to create links that send existing app users directly into the app. The initial setup is also a prerequisite for deep linking and deferred deep linking.
App opening methods
There are two app opening methods that can be implemented to cover your entire user base. The method used depends on the mobile platform version.
The two methods and instructions for implementation are described in detail in the following sections.
Method | Description | Android Versions | Procedure |
---|---|---|---|
Android App Links | Directly opens the mobile app at the default activity. | Android V6+ | |
URI Scheme | Directly opens the app based on the activity path specified in the URI scheme. | Android all versions |
Procedures for Android App Links
Android App Links work with Android V6 and above. Learn more.
Generating a SHA256 fingerprint while in development
- Locate your app's keystore.
If the app is in still in development, locate thedebug.keystore
- For Windows user:
C:\Users\USERNAME\.android\debug.keystore
- For Linux or Mac OS user:
~/.android/debug.keystore
- For Windows user:
- Open the command line and navigate to the folder where the keystore file is located.
- Run the command:
// keytool -list -v -keystore <<KEY_STORE_FILE>>
// For example, the default keystore file
keytool -list -v -keystore ~/.android/debug.keystore
The password for the debug.keystore is usually "android".
The output should look like this:
Alias name: test
Creation date: Sep 27, 2017
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=myname
Issuer: CN=myname
Serial number: 365ead6d
Valid from: Wed Sep 27 17:53:32 IDT 2017 until: Sun Sep 21 17:53:32 IDT 2042
Certificate fingerprints:
MD5: DB:71:C3:FC:1A:42:ED:06:AC:45:2B:6D:23:F9:F1:24
SHA1: AE:4F:5F:24:AC:F9:49:07:8D:56:54:F0:33:56:48:F7:FE:3C:E1:60
SHA256: A9:EA:2F:A7:F1:12:AC:02:31:C3:7A:90:7C:CA:4B:CF:C3:21:6E:A7:F0:0D:60:64:4F:4B:5B:2A:D3:E1:86:C9
Signature algorithm name: SHA256withRSA
Version: 3
Extensions:
#1: ObjectId: 2.5.29.14 Criticality=false
SubjectKeyIdentifier [
KeyIdentifier [
0000: 34 58 91 8C 02 7F 1A 0F 0D 3B 9F 65 66 D8 E8 65
0010: 74 42 2D 44
]
]
- Send the SHA256 back to the marketer.
Generating a SHA256 fingerprint while in production
The SHA256 fingerprint is generated in
- In Google Play console Find the public SHA256 fingerprint in Setup -> App signing (see image below)
- Send the SHA256 back to the marketer.
Adding App Link intent-filter to main activity
- Get the auto-generated intent-filter code from the marketer. The intent-filter code is used in the AndroidManifest.XML.
- Open the app's
AndroidManifest.xml
file. - Add the intent-filter to the main activity.
If there already is an intent-filter for the Android App Link in the main activity, overwrite it.
Example
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="onelink-basic-app.onelink.me"
android:scheme="https" />
</intent-filter>
When
android:autoVerify="true"
is present on any of your intent filters, installing your app on devices with Android 6 and higher causes the system to attempt to verify all hosts associated with the URLs in any of your app's intent filters.
For each unique host name found in the above intent filters, Android queries the corresponding websites for the Digital Asset Links file athttps://hostname/.well-known/assetlinks.json
. Once the redirection logic for existing app users is added to the OneLink template configuration, AppsFlyer creates and hosts this path for you.
Learn more
Github link: XML
- Tell the marketer that the App Link configuration is completed.
When the marketer tests the link, it should direct the user to the app's main page.
Procedures for URI Scheme
A URI scheme is a URL that leads users directly to the mobile app.
When an app user enters a URI scheme in a browser address bar, or clicks on a link based on a URI scheme, the app launches, and the user is deep linked.
Whenever an App Link fails to open the app, the URI scheme can be used as a fallback to open the application.
Deciding on a URI scheme
To decide on a URI scheme:
-
Contact the marketer.
-
Choose a URI scheme. For example:
yourappname://
- Use a URI scheme that is as unique as possible to your app and brand to avoid coincidental overlap with other apps in the ecosystem. Overlap with other apps is an inherent issue in the nature of URI scheme protocol.
- The URI scheme should not start with http or https.
- The URI scheme should be similarly defined on Android and iOS.
-
Send the URI scheme to the marketer. For example:
afshopapp://mainactivity
Adding URI scheme intent-filter to the main activity
To add the intent-filter to the main activity:
- Open the app's
AndroidManifest.xml
file. - Add the following intent-filter to the main activity.
In thedata
section, replacehost
andscheme
with the URI scheme you chose. In the intent-filter code below,host="mainactivity"
andscheme="afshopapp"
, matching the URI schemeafshopapp://mainactivity
.
If there already is an intent-filter for the URI scheme in the main activity, overwrite it.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="mainactivity"
android:scheme="afshopapp" />
</intent-filter>
⇲ Github link: XML
- Give the URI scheme to the marketer.
Testing URI schemes
Prerequisites:
An Android device with the app installed. Make sure it is the app source and version where you made changes and implemented App Links and/or a URI scheme.
To test the URI scheme:
- Contact the marketer and get the custom link they created.
- Send the short or long URL the marketer gives you to your phone. You can either:
- Scan the QR code with your phone camera or QR scanner app.
- Email or WhatsApp yourself the link, and open it on your phone.
- Click the link on your mobile device.
The app should open to its home screen.
Updated 8 months ago