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>
Related
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
I want to verify my app links as these are directly opening in browser in Android 12. I referred this documentation to verify my app links. But it still shows 0 verified links in my app info. Below is my code of SplashActivity in manifest file
<activity
android:name="in.powerplay.splash.SplashActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme"
tools:ignore="LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<data android:host="portal.getpowerplay.in" />
<data android:host="profile.getpowerplay.in" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:scheme="app" />
<data android:scheme="pp" />
</intent-filter>
</activity>
I also added the links in assets.json file and you can see in the below screenshots that it's working fine
screenshot 1
screenshot 2
Any help would be appreciated. Thanks in advance!
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.
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 building a app with sounds to be shared via WhatsApp, it's almost done, however is missing a single thing, that I already tried everything, but nothing seems to work.
I wanna that when the user click on share button of own whatsApp (the one that is a clip) my app be listed on list of possible apps to do that action, this way:
I already tried
use a intent filter on a activity like
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="audio/*" />
</intent-filter>
and too
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" />
</intent-filter>
however my app wasn't shown, I already saw that is possible with other apps, I'm just doing something wrong.
How I can do to make my app be listed? Anyone knows?
Really Thx.
Note - the image is just a example, not a real one 'cause I can't print the screen of a real device, then I found this one on internet :(
EDIT 1
I tried this way too, but did not work
<activity
android:name=".activities.HomeActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
</activity>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="audio/*" />
</intent-filter>
//and too
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" />
</intent-filter>
Replace With below code
//this is to get text from other app
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="audio/*" />
</intent-filter>
For more idea here is an official document form android : https://developer.android.com/training/sharing/receive.html