-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.

2
  • You do some research before asking pls. stackoverflow.com/questions/11753000/…
    – PYPL
    Commented Jan 12, 2017 at 7: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
    Commented Jan 12, 2017 at 8:21

1 Answer 1

0

Use a proper format:

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.