Android: intent filter verification failure - android

My goals is to have Android automatically open any link that starts with test.touchwonders.com in my app. I have place the required file on my server: https://test.touchwonders.com/.well-known/assetlinks.json
This is the relevant part of my manifest:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:name="com.justbrands.highstreet.pmelegend.PmeApplication">
<activity
android:name="com.highstreet.core.activity.MainActivity"
android:label="#string/app_name" >
<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="http" />
<data android:scheme="https" />
<data android:host="test.touchwonders.com" />
<data android:host="www.test.touchwonders.com" />
</intent-filter>
<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="pme-legend"/>
</intent-filter>
</activity>
</application>
When installing the app, however, this is the output I see in logcat:
06-27 09:48:43.267 6488-6488/? D/IntentFilterVerRcvr: Received ACTION_INTENT_FILTER_NEEDS_VERIFICATION.
06-27 09:48:43.276 6488-8080/? I/IntentFilterIntentSvc: Verifying IntentFilter. verificationId:14 scheme:"https" hosts:"test.touchwonders.com www.test.touchwonders.com" package:"com.justbrands.highstreet.pmelegend.acceptance".
06-27 09:48:43.531 6488-8080/? I/IntentFilterIntentSvc: Verification 14 complete. Success:false. Failed hosts:test.touchwonders.com,www.test.touchwonders.com.
My device uses the Charles proxy which allows you to see requests. I see no requests going out to test.touchwonders.com tough. I used adb shell pm clear com.android.statementservice beffore installing, which should have cleared the cache and forced a re-fetch of the json.

It turned out the problem was not in my app, but in the assetlinks.json file on the website's server. In my case the problem was that the MIME type oft he server's response was not application/json My real problem was that I did not have a method of testing my assetlinks file. I have found one in the meantime:
Refer to https://developer.android.com/training/app-links/index.html#testing
and use the testing url
https://digitalassetlinks.googleapis.com/v1/statements:list?
source.web.site=https://<domain1>:<port>&
relation=delegate_permission/common.handle_all_urls

I had the same problem and the problem was not related to assetlinks.json file. I had 3 different domains and one of them was failing to due some misconfiguration. Even if only one domain was failing, applink was not working for other domains either. You may want to check if all the domains are working as expected.

Related

Deeplink errors displayed on Google Console different from in AndroidManifest.xml

My app shows errors with a deeplink in Google Play Console:
In which the failed link was "https:///"
In the AndroidManifest.xml has this configuration:
<activity
android:name=".AppLinksActivity"
android:resizeableActivity="false"
android:exported="true"
android:launchMode="singleTask">
<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="your_game_domain.extads.gl.com"
/>
</intent-filter>
</activity>
The other link works just fine. I don't know where the triple dashes in the faulty link come from.
Could anyone help me find the causes and how to fix this? Much appreciated.

Android Instant App URL execution trouble

I've created what I think is an android instant app. When ever I test the instant app functionality via Android Studio it works as expected. I've followed the instructions to generate the associated files for linking the instant app to a URL and placed them accordingly on my site. I've uploaded a signed bundle to a alpha closed testing track. The URL I'm using will work to launch the app. However, when I goto Settings-> Google-> Apps & Notifications and remove the instant app, the link no longer works it takes me directly to the website. I dont understand what I've done wrong as its my understanding that instant apps dont need to be preinstalled the URL should trigger I assume the play store to send over a bundle to load into memory (of some sorts). Am I correct in thinking I should be able to run an instant app with out installing it first? Any help would be appreciated. Below is my manifest file. Which I believe to be correct.
Almost identical problem to: InstantApp not being launched when clicking on link
I've tried the solution mentioned in that post. To no success.
If this description/question sucks please let me know I will try to make it better. Second post ever first got deleted I presume because it sucked? No idea. Thanks community ahead of time for your help.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools"
package="learn.instantapps">
<!-- The following declaration enables this module to be served instantly -->
<dist:module dist:instant="true"></dist:module>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:targetSandboxVersion="2"
android:theme="#style/AppTheme">
<activity android:name="learn.instantapps.MainActivity">
<meta-data
android:name="default-url"
android:value="https://mysite/main" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:order="1">
<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="my site"
android:path="/main" />
</intent-filter>
<intent-filter android:order="1">
<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="my site"
android:path="/main" />
</intent-filter>
</activity>
</application>
</manifest>

You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter'

Trying to upload instant application but getting this error
You should have at least one active APK that is mapped to site 'sample.com' via a web 'intent-filter'.
<activity
android:name=".ui.InstantSplash"
android:screenOrientation="portrait"
android:theme="#style/splashScreenTheme">
<meta-data
android:name="default-url"
android:value="https://sample.com/base-app/salt_one" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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" />
<data android:host="sample.com" />
<data android:pathPrefix="/base-app" />
<data android:scheme="https" />
</intent-filter>
</activity>
Upload installable APK in alpha, beta or production with same HOST web 'intent-filter'.
You are defining an Intent filter with the scheme and host:
<data android:scheme="http" />
<data android:host="sample.com" />
so you have to access your deep links with
http://sample.com
but this domain must be a valid domain, and this domain must be of your property because you need to add the assetlinks.json
The website www.example.com publishes a statement list at
https://www.example.com/.well-known/assetlinks.json. This is the
official name and location for a statement list on a site; statement
lists in any other location, or with any other name, are not valid for
this site. In our example, the statement list consists of one
statement, granting its Android app the permission to open links on
its site:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : { "namespace": "android_app", "package_name": "com.example.app",
"sha256_cert_fingerprints": ["hash_of_app_certificate"] }
}]
Read more about it:
https://developers.google.com/digital-asset-links/v1/getting-started#quick-usage-example
Instant apps does not support HTTP. Your default-url should be HTTPS
<meta-data
android:name="default-url"
android:value="https://sample.com/base-app/salt_one" />
Your app must also define a default URL for your app. Within the same Android manifest as your entry-point activity, you define the default URL for your app by adding a element with a value attribute that provides a valid HTTPS URL that the activity can handle. Further, this default url must also be part of the CATEGORY_LAUNCHER activity's intent filter in the installed app.
The following code snippet shows an Android manifest that defines an entry-point activity and default URL for an instant app.
<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:scheme="http" />
<data android:scheme="https" />
<data android:host="example.com" />
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://www.example.com/index.html" />
</activity>
Instant apps does not support HTTP. Your default-url should be HTTPS
For more details can you check android AIA documentation.
There is some inappropriate string for error message, can you ensure fix with, installable APK in alpha, beta or production with same HOST web 'intent-filter'.

Intent.action.VIEW does not work on some devices

I need to open my application when clicked the URL Link in E-mail, Message or Browser applications. So, see the my code for this feature:
<activity
android:name=".ui.main.MainActivity"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="https" />
<data android:scheme="https" android:host="www.mysite.org"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.APP_EMAIL"/>
<category android:name="android.intent.category.APP_MESSAGING"/>
<category android:name="android.intent.category.APP_BROWSER"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
This code is sufficient and works on some mobile devices, especially devices with android versions 5.0, 6.0 and 7.0 but does not work on versions 7.1 and 8.0. Why does this happen? Is it a permission problem?
Ex: Your url will be something like https://example.com and you have the intent filter in Android Manifest as below:
<activity
android:name="com.droid.MainActivity"
android:label="#string/app_name" >
<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="https" />
</intent-filter>
</activity>
Use the URL Mapping editor to easily add URL intent filters to your Activities with Android App Links (Android Studio > Tools > Android App Links).
After reading changes in Android O I came to the conclusion that the problem is described as follows
URIs cannot contain empty labels. Previously, the platform supported a
workaround to accept empty labels in host names, which is an illegal
use of URIs. This workaround was for compatibility with older libcore
releases. Developers using the API incorrectly would see an ADB
message: "URI example..com has empty labels in the hostname. This is
malformed and will not be accepted in future Android releases."
Android 8.0 removes this workaround; the system returns null for
malformed URIs.
So try adding android:label="string resource" to your intent-filter syntax so the user will see it in the alternatives menu.

Android Dropbox SDK manifest setup

Any ideas why I get this error when I call getSession().startAuthentication() for the Android Dropbox SDK?
: FATAL EXCEPTION: main
: java.lang.IllegalStateException: URI scheme in your app's manifest is not set up correctly. You should have a com.dropbox.client2.android.AuthActivity with the scheme: db-CHANGE_ME
Yet my AndroidManifest.xml has the following within the <Application></Application> as instructed in the getting started instructions.
<activity
android:name="com.dropbox.client2.android.AuthActivity"
android:launchMode="singleTask"
android:configChanges="orientation|keyboard">
<intent-filter>
<!-- Change this to be db- followed by your app key -->
<data android:scheme="db-MYKEYISHERE" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
If you're actually seeing "db-CHANGE_ME" (i.e. that's not a placeholder you used to obscure your app key), then it means you haven't updated the app key in the Java code of your app. That error message outputs the key which was provided in the Java code, and expects it to match the key in the manifest.
Your clean build might've picked some Java changes which weren't previously built.
For those facing this problem, if you're like me you might not pay attention to a little detail, take a look at your manifest:
<intent-filter>
<data android:scheme="db-APP_KEY" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
You shouldn't replace the whole string db-APP_KEY with your app key, you should leave db- there db-{HERE YOUR APP KEY} I know I know, it took me a while to figure out this.
Example:
<intent-filter>
<data android:scheme="db-hafsa324dasd" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
When I copied the App_ Key I forgot to add the 'db' part to my answer.
Example:
<data android:scheme="db-APP_KEY" />
Should be :
<data android:scheme="db-hafsa324dasd" />
Should Not Be :
<data android:scheme="hafsa324dasd" />
No idea why this should be the case but a project clean did the trick (I added the code to the manifest days ago and cleaned several times since)

Categories

Resources