Facing issue while publishing Instant App on Google Play Console - android

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

Related

Deeplinks only work when using a slash in Jetpack Navigation

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>

App links not getting verified in Android

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!

Deep linking sometimes opens wrong activity

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.

You must use the http and https protocols for intent filters. Why receive this error message?

When I choosing to upload android Instant App apk-s zip to Google Play Developer Console I receive this error: Upload failed. You must use the http and https protocols for intent filters
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.feature">
<application>
<meta-data
android:name="asset_statements"
android:resource="#string/asset_statements"/>
<activity android:name=".ui.MainActivity">
<tools:validation testUrl="https://com.example/"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter
android:order="1"
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="com.example"
android:pathPattern="/.*"/>
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://com.example"/>
</activity>
</application>
I was having this problem until I changed my AndroidManifest to this way
<activity android:name=".MainActivity">
<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:host="example.com" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:pathPattern="/InstantApp" />
</intent-filter>
</activity>
I was using intent-filter to receive dynamic link but also was integrating deep link in navigation graph, for this reason it was also necessary to include "http" and "https" support in the nav_graph.xml document.
<fragment
android:id="#+id/someFragment"
android:name="com.apps.example.SomeFragment"
android:label="fragment_some"
tools:layout="#layout/fragment_some" >
<deepLink
android:id="#+id/deepLink1"
app:uri="https://example.page.link" />
<deepLink
android:id="#+id/deepLink2"
app:uri="http://example.page.link" />
</fragment>
Make sure your intent-filter has at least the following attributes. Both "http" and "https" scheme must be present at the same time:
<intent-filter
android:autoVerify="true"
android:order="1">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="abc.com" />
<data android:pathPattern="/def" />
<data android:scheme="https" />
<data android:scheme="http" />
</intent-filter>

Android - url scheme does not work and application does not open

I want to run my app from a custom url.
I added the following to the AndroidManifest:
<activity android:name=".app.RunFromUrlActivity"
android:launchMode="singleInstance">
<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="myapp"/>
</intent-filter>
</activity>
However, when i try to go to myapp://data the browser simply searches fot that string instead of running my Activity.
What am i doing wrong?
Try something like this for "data":
<data
android:host="com.yourpackage.yourotherstuff.TheActivity"
android:scheme="yourscheme" />
Here's one that works for my app:
<activity android:name=".BrowserActivity" >
<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="com.mypackage.otherstuff.BrowserActivity"
android:scheme="myapp" />
</intent-filter>
</activity>
This makes my activity accessible via myapp://com.mypackage.otherstuff.BrowserActivity.

Categories

Resources