We're encountering some issue with the deep linking. We have two deep linking providers. Firebase and Branch. We have our users experiencing issue where they click Firebase link, lets say to open activity A, but instead it opens activity B (which is for Branch). Unfortunately we are not able to reproduce it, but it happens to some of our users. And when this happens, it's always reproduce-able for them.
This is the Firebase setting we have
<activity android:name=".activity.FirebaseActivity"
android:screenOrientation="portrait">
<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="firebase.page.link"
android:scheme="https" />
</intent-filter>
</activity>
and for Branch:
<!-- Branch URI scheme -->
<intent-filter>
<data
android:host="open"
android:scheme="branch" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<!-- Branch App Links -->
<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="branch.app.link"
android:scheme="https" />
</intent-filter>
</activity>
Finally found the issue that is causing this.
We have the dynamic link domain as {firebase-dynamic-domain}.page.link. However, in some cases, when user gets redirected to the app, the link is showing as
https://{your-project}.firebaseapp.com&...
instead of
https://{firebase-dynamic-domain}.page.link?link=https://{your-project}.firebaseapp.com&...
To fix this, you can add the project name domain for the filter as well or catch this in the launcher activity
<activity android:name=".activity.FirebaseActivity"
android:screenOrientation="portrait">
<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="firebase.page.link"
android:scheme="https" />
</intent-filter>
<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="{your-project}.firebaseapp.com"
android:scheme="https" />
</intent-filter>
</activity>
A Branchster Here -
We never faced this issue. Firebase and Branch can work perfectly fine with each other in parallel. If you are clicking a Branch Link, it'll open the corresponding activity. Since this is not happening for you across the board I'd suggest you to recheck on the configuration and see if there's a pattern where this is observed and try reproducing it from your end.
Related
I'm trying to use <nav-graph> generator to generate <intent-filter> elements in my AndroidManifest.xml
In one of the fragments in my nav_graph.xml, I added:
<deepLink app:uri="axzae://notifications" />
In the generated APK, the AndroidManifest.xml looks like below
<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:scheme="axzae" />
<data android:host="notifications" />
<data android:path="/" />
</intent-filter>
Now, the problem is with the additional android:path="/". It made the app only respond to axzae://notifications/ but not axzae://notifications (take note of the ending slash)
Is there anywhere I can make <nav-graph> to support axzae://notifications deeplink or without generating the <data android:path="/" /> line?
apparently, jetpack navigations can't resolve the generated axzae://notifications/. the app launched but it will always open up your startDestination. so it's actually broken.
another thing to note is it works fine for second-layer deep links. Example axzae://notifications/settings will work fine.
I will resort to a workaround for now by manually populating the TLD/host-only deep links in AndroidManifest.xml
<activity
android:name=".ui.MainActivity"
android:exported="true"
android:theme="#style/Theme.App">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<nav-graph android:value="#navigation/nav_graph" />
<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:scheme="axzae" />
<data android:host="home" />
<data android:host="notifications" />
...
</intent-filter>
</activity>
I am facing the below issue while publishing the Instant app from Google Play Console.
The same app is published before without any error. Please check the manifest content of the Instant app. Domain masked for privacy.
The default URL is set in Instant and main app as well. FYI, the source code for Instant and main is different.
<activity
android:name=".InstantPaymentHome"
android:windowSoftInputMode="adjustResize"
android:configChanges="locale"
android:exported="true">
<meta-data
android:name="default-url"
android:value="https://www.mydomain.com.sa" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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:scheme="https"
android:host="mydomain.com.sa"
android:pathPattern="/pay" />
</intent-filter>
<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:scheme="https"
android:host="www.mydomain.com.sa"
android:pathPattern="/pay" />
</intent-filter>
<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:scheme="http"
android:host="mydomain.com.sa"
android:pathPattern="/pay" />
</intent-filter>
<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:scheme="http"
android:host="www.mydomain.com.sa"
android:pathPattern="/pay" />
</intent-filter>
</activity>
So I faced the same issue and after some trial and error I have managed to get passed it
My setup was quite similar to the OP
The problem, I believe, is that the URL defined in <meta-data android:name="default-url" android:value="https://www.mydomain.com.sa" /> does not exactly match the one defined in the <intent-filter> because the <intent-filter> has android:pathPattern="/pay" so the URL defined by the intent-filter is "https://www.mydomain.com.sa/pay" but default-url is "https://www.mydomain.com.sa" without the /pay
So the solution that worked for me is to change the default-url to this
<activity ...>
<meta-data
android:name="default-url"
android:value="https://www.mydomain.com.sa/pay" />
....
</activity>
I have found a much cleaner solution. Just add the /.* to the pathPattern as below. The rest of the default-url and other remains remain the same.
<data
android:scheme="https"
android:host="www.example.com.sa"
android:pathPattern="/pay/.*" />
This has solved the problem I was facing.
Adding the wild character /.* will match any URL with a pattern like below
http://www.example.com/pay/en?amount=67&number=06737364646
http://www.example.com/pay/ar?amount=67
http://www.example.com/pay?amount=67
Let's say in my app, users can make posts & send messages to other users, & I want to register my app as a component among those appears in the Share-via picker when sharing either text or an image, I'm defining my 2 activities in my AndroidManifest.xml as follows (like this official example):
<activity
android:name=".SharePostActivity"
android:label="MyApp (Post)">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ShareMessageActivity"
android:label="MyApp (Message)">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
When sharing text, this works perfectly fine, where I see 2 icons of my app among available apps for sharing text, named MyApp (Post) & MyApp (Message),
Problem happens when sharing an image, because only one icon appears with the second defined label in the manifest (which is MyApp (Message)), and actually it opens the first defined activity in the manifest (which is SharePostActivity),
So, how to show the 2 options when sharing an image (just like what happens when sharing text)?
(I've tried on an emulator running Nougat & a real device running Oreo)
----- Update -----
I've found that this weird behavior happens only when sharing images from Google's Photos app, but everything works fine when sharing an image from other apps!
Some investigation leads to a solution: each of your intent-filter must contain an android:label which points to a resource, not a hardcoded string.
...
<intent-filter android:label="#string/first_value">
...
Different Activities must have different labels, so in your case the Manifest should look like
<activity
android:name=".SharePostActivity"
android:label="#string/my_app_post">
<intent-filter
android:label="#string/my_app_post">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter
android:label="#string/my_app_post">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ShareMessageActivity"
android:label="#string/my_app_message">
<intent-filter
android:label="#string/my_app_message">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter
android:label="#string/my_app_message">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
I'm trying to configure deeplinks for my app. I configured several options like:
https://myapp.com/news ---> NewsActivity
https://myapp.com/history ---> HistoryActivity
with intent filters like:
<intent-filter android:label="MyApp">
<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="myapp.com"
android:pathPrefix="/news" />
</intent-filter>
and
<intent-filter android:label="MyApp">
<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="myapp.com"
android:pathPrefix="/history" />
</intent-filter>
I also want a link pointing from the base domain to my main activity
https://myapp.com ---> MainActivity
I want the link to respond to the base domain but no to other links like: https://myapp.com/playlists since the playlist features is not currently implemented in the app and is better to redirect to the web.
But when I set the intent filter:
<intent-filter android:label="MyApp">
<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="myapp.com"
android:path="" />
</intent-filter>
I receive the following lint warning:
android:path cannot be empty
Ensure the URL is supported by your app, to get installs and traffic
to your app from GoogleSearch.
More info: https://g.co/AppIndexing/AndroidStudio
Despite this warning, the behavior it is correct. How can I fix this warning?
Had the same issue, you can just ignore the warning with tools:ignore="AppLinkUrlError"
So your intent would be:
<intent-filter android:label="MyApp">
<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="myapp.com"
android:path=""
tools:ignore="AppLinkUrlError" />
</intent-filter>
Add xmlns:tools="http://schemas.android.com/tools" to your initial manifest tag if it's not already there.
I'm trying to achieve to have my application launched (or fire an open-in dialog) when a link pointing to http://example.com/123 on my website is clicked.
In my AndroidManifest.xml I added the following activity to register my app for 'http' links with host 'example.com'. But it simply visits http://example.com/123 link and nothing happens other than that when I touch on the link.
<activity xmlns:android="http://schemas.android.com/apk/res/android"
android:name=".TestActivity"
android:label="myapplication">
<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="example.com" android:scheme="http" />
</intent-filter>
</activity>
Also tried with
android:pathPattern = ".*"
or
android:pathPattern = "*"
but none of them work. I appreciate for any suggestions from now.
Try using pathPrefix instead of pathPattern.
<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="example.com"
android:scheme="http"
android:pathPrefix="/"/>
</intent-filter>