-2

Google has a nice page here showing how to do this: https://developer.android.com/distribute/tools/promote/linking.html

Basically, use this code, and it will open the Play Store to the new apps page:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=com.example.android"));
startActivity(intent);

When I try this however, I get the error:

 Cannot resolve the symbol 'Uri'

What am I missing? I'm sure its extremely simple, perhaps something I need to import.

SOLVED: Importing the Uri class was the issue. I'm still not sure what the new hot key is to import it. Apple-Shift-o doesn't work anymore. A button on the line showed up after a while and offered to import it for me.

  • You do some research before asking pls. http://stackoverflow.com/questions/11753000/how-to-open-the-google-play-store-directly-from-my-android-application – PYPL Jan 12 '17 at 07:56
  • I think you should rephrase your question - to my understanding, it is not a duplicate, because you know how it should work -- it is about the error you get. I suppose it is a runtime error, right? If it's a compiler error, you simply have to import the Uri class. – Ridcully Jan 12 '17 at 08:21

1 Answers1

0

Use a proper format:

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri.parse("market://details?id=com.example.android"));
startActivity(intent);
W4R10CK
  • 5,502
  • 2
  • 19
  • 30