I've been working on an instant app to go along with my existing application. When I reach a certain point in the instant app, I try and prompt the user to download the full application from the playstore, however, I instead receive a dialog saying "Item not found", with a button that says "Retry".
I've been reading these docs here: Developer reference > instantapps.InstantApps but they are kind of unclear to me.
From the docs: "If your instant app minSdkVersion is 26 or higher, you can use framework methods directly instead of using the compatibility library."
My minSdk version
as of now is 16 (don't think this is right, pretty certain instant apps minsdk
is 21 or something, i just made the minimum to be the same as my current application).
Anyways, does the minSdkVersion
have to be 26 in order for the showInstallPrompt
method to work? I am not exactly sure what the docs mean when they say i can use the compatibility library, I imagine this is one of the support libraries, but i cannot be certain as to which one.
My Current supportVersion is 27.1.1, and includes the following libraries:
compile "com.android.support:transition:$supportVersion"
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:cardview-v7:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
compile "com.android.support:support-v13:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:support-v4:$supportVersion"
compile "com.android.support:support-v13:$supportVersion"
compile "com.android.support:support-annotations:$supportVersion"
I also include the instantApps library as well, as specified in the docs
compile 'com.google.android.instantapps:instantapps:1.1.0'
and my buildToolsVersion is 27.0.3. App's target sdk is 27, with min of 16.
Code to show install prompt:
myIntent = new Intent(this, MyActivity.class)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
.putExtras(bundle);
InstantApps.showInstallPrompt(this, myIntent, 0, "InstantApp");
The bundle in the intent contains a single boolean value.
If anyone knows of a way to make this work without changing the minSdk to 26, that would be awesome. Otherwise i may have to do some other type of custom solution.