2

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.

Zoe
  • 27,060
  • 21
  • 118
  • 148
hermt2
  • 844
  • 3
  • 14
  • 33
  • NOTE: Just tried changing my minSdk to 26 and still received the Item not found dialog – hermt2 Apr 12 '18 at 22:39
  • Can you post your full code for the `showInstallPrompt`, including the `myIntent`? Is your installed-app published to Release? And do you see anything in the logs? – TWL Apr 12 '18 at 23:32
  • Yeah I'll add the intent to the original post. And I have a previous version on the playstore, but it isn't setup with instant apps. Does it need to be in order for that dialog to work? And I was running on the debug build variant. Does it need to be ran on release or something? Gonna check the logs now. – hermt2 Apr 13 '18 at 11:33
  • 1
    Ahhhhh.. Okay great call on checking the logs. It says there was an error loading the given package name, because i add an extra applicationId suffix to my debug build variant. so it looks it appears that is why resource cannot be found – hermt2 Apr 13 '18 at 11:41
  • Yup that did it. Thank you for the help. – hermt2 Apr 13 '18 at 11:55

0 Answers0