Android Instant App URL execution trouble - android

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>

Related

Google play not accepting instant app due to digital asset link

I've been trying for a week to solve this issue with no luck!
Google play is still not convinced that I have linked my website properly!, whenever I upload my instant app I get the usual:
Your site 'www.servstore.co' has not been linked through the Digital Asset Links protocol to your app. Please link your site through the Digital Asset Links protocol to your app.
Noting that both my instant app and installed app have the same code base (single module), and are actually 9.4 MB after minification.
I know this has been asked multiple times, and I've seen mutiple SO posts about this, however none of the resolutions I've read seem to work for me, I actually tried all of them so far with no luck, What I've done so far to debug this issue:
Website Side:
Made sure assetlinks.json is uploaded to my website and administered with appropriate Content-Type header.
Made sure the file is available with public permission (777)
Made sure robots.txt allows crawling for the file, I actually only have the below in it:
User-Agent: *
Allow: /.well-known*
Verified asset link https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://www.servstore.co&relation=delegate_permission/common.handle_all_urls
made sure the asset link is using the right SHA-256 (private key in Google Play), I also never use an upload key, I directly sign my app with the same key and have opted in to Google play signing using that key.
App Side:
added asset_statements to my strings.xml and meta-data under application tag in AndroidManifest.xml
Made sure the first intent-filter containing app link has auto-verify = true in my manifest, also tried to mark all 3 activities that have intent-filter URLs with auto-verify
Added default-url in the manifest to all 3 activities and tried with only the main activity.
Added networkSecurityConfig to xml resources and reference it in the manfiest:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="false">
<domain includeSubdomains="true">www.servstore.co</domain>
</domain-config>
</network-security-config>
In Google Play:
Enabled instant-app release type in new Google Play console.
published the same code to standard release type in Google Play with version code higher than the one I use for my instant app.
I am ready to try anything ..
here is my manfiest file, removing unrelated activities:
<?xml version="1.0" encoding="utf-8"?>
<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="co.servstore.client"
android:targetSandboxVersion="2">
<dist:module dist:instant="true" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:name=".ServStoreApp"
android:allowBackup="false"
android:icon="${appIcon}"
android:label="#string/app_name"
android:roundIcon="${appIconRound}"
android:supportsRtl="true"
android:theme="#style/Theme.ServeStore.NoActionBar"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:allowBackup,android:theme"
android:networkSecurityConfig="#xml/network_security_config">
<service
android:name=".services.notifications.NotificationService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="***" />
<meta-data
android:name="asset_statements"
android:resource="#string/asset_statements" />
<activity
android:name=".ui.main.MainActivity"
android:screenOrientation="nosensor"
android:windowSoftInputMode="adjustResize|stateHidden">
<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="www.servstore.co"
android:scheme="https" />
<data android:scheme="http" />
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://www.servstore.co" />
</activity>
<activity
android:name=".ui.orders.OrderDetailsActivity"
android:screenOrientation="nosensor">
<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="www.servstore.co"
android:path="/businessOrders"
android:scheme="https" />
<data android:scheme="http" />
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://www.servstore.co" />
</activity>
<activity
android:name=".ui.orders.CustOrderDetailsActivity"
android:screenOrientation="nosensor">
<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="www.servstore.co"
android:path="/userOrders"
android:scheme="https" />
<data android:scheme="http" />
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://www.servstore.co" />
</activity>
</application>
</manifest>
To resolve to a particular host url, you should provide the host.
Can you try to remove:
<data android:scheme="http" />
Or add host for the http scheme like below
<data
android:host="www.servstore.co"
android:scheme="http" />
I have had similar difficulties and am trying some things that might help you. Your problem might be a missing intermediary SSL certificate.
When you run the App Link Tester you probably are getting an error response "URL resolving conflicts, please link and verify your digital asset links"
If you then run Postman to connect to your domain (by https) you get an "SSL error: Unable to verify the first certificate". But you will find an HTTPS browser connection to a page on your server works fine.
In my case I understand from Sectigo that one intermediary certificate is installed with the SSL, but the second one is not. I would suggest that you call Sectigo tech support (888.391.4357). You may need guidance to get the missing intermediary certificate.
You didn't include your build.gradle(app) so you might check your SDK versions. They may be tied up with the problems with the READ_PHONE_STATUS permission which you do require as reported in Google play not accepting instant app due to digital asset link
If you have simply accepted the addition implicitly, you might try removing it:
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
tools:node="remove" />
That post also indicates problems with certain versions of play-services. Try:
implementation 'com.google.android.gms:play-services-base:17.6.0'
implementation 'com.google.android.gms:play-services-instantapps:17.0.0'

Single Activity intent.action.VIEW with Crashlytics-Beta causing two instances of App running at same time

i have run into very strange behavior of crashlytics beta when tester claims he is able to run two instances of app at the same time.
Log is telling me that its completely same packageName so we cant distinguish from which that log came.
I did some research and beta is propably running it inside their app with something like this:
Intent i = getPackageManager().getLaunchIntentForPackage("com.package.ofapp");
startActivity(i);
with combination of action.View in manifest its causing to run two instances of the app
<activity android:name="com.kebab.KebabApp">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
So i would say its ok. Just lets get rid of the action.View.
<action android:name="android.intent.action.VIEW" />
After that its start screaming at me:
App is not indexable by Google Search; consider adding at least one
Activity with an ACTION-VIEW intent-filler. See issue explanation for
more details.
So i have to put ignoring GoogleAppIndexingWarning into lint because i am using google single app standard combining with crashlytics beta ?
Here is my manifest #HB
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="package">
<!-- permissions -->
<application
android:name="package"
android:allowBackup="true"
android:icon="${appIcon}"
android:label="#string/app_name"
android:roundIcon="${roundIcon}"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name="package.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

Android: intent filter verification failure

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.

Can't launch Android App in my device

I'm trying to run App that has a search in its action bar and also it shares in twitter. When I run my App, I got this message in console
Application already deployed. No need to reinstall.
\Healthy_Tips2\bin\Healthy_Tips2.apk installed on device
Done!
But I can't find my App with Apps menu in the device and the App is not launching..
The following is the code of my start activity manifest.xml
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEARCH" />
<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.emy.healthytips.MainActivity"
android:scheme="oauth" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable"/>
<!-- enable the base activity to send searches to itself -->
<meta-data
android:name="android.app.default_searchable"
android:value=".MainActivity" />
</activity>
Aside from uninstalling the previous app through adb like the others have already mentioned.
In your manifest, you should increment your versionCode="1" by 1 more and break down your intent filter into two. This will still work. An activity can have more than one intent-filter.
<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.SEARCH" />
<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.emy.healthytips.MainActivity"
android:scheme="oauth" />
</intent-filter>
Go to Project -> clean -> run your project.
this will rebuild your project.
Then run your project again. Usually works. Or else are you sure you are not trying to run a library Project??
Use adb to uninstall your application:
adb uninstall package_name
See link:
http://adbshell.com/commands/adb-uninstall/how-to-use-adb-uninstall.html
Edit: Go to sdk/platformtools under command line tool. And write this line:
adb uninstall <package_name>
Make any change to your app. add a comment or so, or uninstall your app then deploy again.
I personally always have the same problem, when I'm trying to install an apk via phone, although it's already installed via PC. For me it works to simply deinstall the final app and try once more to install the apk.
I get this error when I try running my app without making changes when the app is already open.
Try closing/restarting your emulator/phone and reopening it.
Also try making a change to the app, then deleting it and save it (type "A" anywhere in the code then remove it).
Then try cleaning your project: project > clean
If that doesn't work, try uninstalling the app after trying above methods and try again. This should work.

Android App not compatible with devices that sideload Google Play

I have an app which has been deployed to Play and is compatible with any device running 2.1 or later; no special restrictions or requirements defined in AndroidManifest.xml.
There have been several complaints from users trying to install the app via Google Play but getting messages that it is not compatible. In all of these cases sideloading the app works perfectly.
Digging a little deeper into the problem it appears that in all cases, the people reporting the problem are using a device that did not ship with Google Play installed. IE. the device probably failed Google's CTS.
Having said that, they are able to install other apps via Google Play but not ours. Again, sideloading our app onto these devices works fine. Does anybody know why this might be? I assume it must be something I am doing incorrectly in AndroidManifest.xml but I see nothing suspicious.
EDIT: Here's the AndroidManifest.xml, altered to protect the names of the innocent:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.foo.bar"
android:versionCode="1"
android:versionName="#string/global_app_version">
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="10"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:label="#string/global_app_short_name" android:icon="#drawable/app">
<activity android:name=".HomeActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".AActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
<activity android:name=".BActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
<activity android:name=".CActivity"
android:launchMode="singleTask"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="stateHidden">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
<activity android:name=".DActivity"
android:launchMode="singleTask"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
<activity android:name=".EActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
<activity android:name=".FActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.VIEW"/>
</intent-filter>
</activity>
<!-- This activity is invoked whenever an xxx is opened -->
<activity android:name=".GActivity"
android:theme="#android:style/Theme.Black.NoTitleBar">
<intent-filter android:label="#string/global_app_short_name">
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.intent.action.EDIT"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:mimeType="application/xxx"/>
<data android:mimeType="application/yyy"/>
<data android:mimeType="application/zzz"/>
<data android:mimeType="application/aaa"/>
<data android:mimeType="application/bbb"/>
</intent-filter>
</activity>
</application>
</manifest>
I found the culprit - Copy Protection was enabled. From Google's notes on the setting:
http://developer.android.com/guide/google/play/filters.html
To copy protect an application, set copy protection to "On" when you
configure publishing options for your application. Google Play will
not show copy-protected applications on developer devices or
unreleased devices.
In other words, having to side-load Google Play is just a side effect of being an "unreleased device" / device that fails the Google CTS. In any case, disabling copy protection resolved the issue.
Maybe the hardware they are running is not compatible with your app? Maybe you require a touch screen and they don't have it; maybe you require telephony and they don't have it?
Note that depending on your target api you might get some implicit hardware requirements.
Anyway, trying to get a log from them would be most helpful!
Maybe the affected users can try and reset the Google Play Store app on their devices:
Menu --> Settings --> Apps --> Google Play Store
Then click "Force close" and "Clear data"
Then start Google Play Store again, login, and try to install your app again.
If you have any in-app products or if you are selling the application for money then Google Play automatically filters you out of certain countries it doesn't support billing for. You can email Google to ask here.

Categories

Resources