I am creating an android based webview application for example.com with Java.
After clicking on any link, if the application is installed, I want the relevant link to open in the application. This process takes place for versions before Android 12. For example, if the user clicks on the link https://example.com/xyz/ in any browser, the relevant link opens in the application.
However, for Android 12 and later, links always open in the browser.
I have provided the necessary steps for Deep Link for Android 12 and later:
- 1-) Android Manifest Update
- 2-) Creating assetlinks.json File (Note: Testing was done with SHA256 fingerprint created from .apk file. So, SHA256 fingerprint in json file was taken from apk file.)
- 3-) Distributing the assetlinks.json File on the Server (https://example.com/.well-known/assetlinks.json)
- 4-) Checking the Accuracy of the assetlinks.json File
- 5-) Verifying Changes on Android
Test Realized: Success Host example.com grants app...
However, application redirection still does not occur for Android 12 and above. I looked through the links below and couldn't find a solution:
Developer Android Tutorial Deeplink...
Android app link not working in...
...
---- AndroidManifest.xml ----
<activity
android:name=".MainActivity"
android:exported="true">
<!-- - - -Deeplink-->
<intent-filter android:autoVerify="true" tools:targetApi="m">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="http"
android:host="*example.com"
android:pathPattern=".*" />
<data
android:scheme="https"
android:host="*example.com"
android:pathPattern=".*" />
</intent-filter>
<!-- Deeplink- - - -->
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
---- MainActiviy.java ----
//...
@Override
protected void onCreate(Bundle savedInstanceState) {
//...
String URL = "https://example.com";
Intent intent = getIntent();
Uri data = intent.getData();
if (Intent.ACTION_VIEW.equals(intent.getAction()) && data != null) {
String path = data.getPath();
URL+=path;
}
webview.loadUrl(URL);
//...
}