Reputation: 78
I would like to open a link to a specific app in the Play Store on Android TV.
The normal way of doing it does not work
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
ComponentName comp = new ComponentName("com.android.vending",
"com.google.android.finsky.activities.LaunchUrlHandlerActivity");
intent.setComponent(comp);
intent.setData(Uri.parse("market://details?id=" + packageName));
startActivity(intent);
This opens Google Play, but does not go to the app. Instead, a dialog pops up saying "To view this content, install and setup a web browsing app"
How can I get it to open the page for a specific app?
Upvotes: 1
Views: 1177
Reputation: 78
Now I feel stupid, I just had to .trim() my packageName because it had a newline at the end.
If anyone else is looking for this, the above code works to open apps in the Play Store on Android TV.
Upvotes: 2