【发布时间】:2018-09-17 12:38:42
【问题描述】:
我正在创建一个 android 应用程序,用户可以选择从我的应用程序中启动 amazon prime 应用程序。我找不到 amazon prime 应用程序的包名称。此代码仅在浏览器中打开 amazon prime。
public void onClick(View v) {
String urlAmazonPrime = "https://www.primevideo.com";
Intent intentAmazonPrime = new Intent(Intent.ACTION_VIEW, Uri.parse(urlAmazonPrime));
intentAmazonPrime.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intentAmazonPrime.setPackage("com.amazon.amazonvideo.livingroom");
try {
response = "success";
startActivity(intentAmazonPrime);
} catch (ActivityNotFoundException ex) {
// Chrome browser presumably not installed so allow user to choose instead
intentAmazonPrime.setPackage(null);
startActivity(intentAmazonPrime);
response = "notfound";
Toast.makeText(MainActivity.this, "Amazon Prime Not Found", Toast.LENGTH_SHORT).show();
}
}
【问题讨论】:
-
包是
com.amazon.avod.thirdpartyclient。com.amazon.amazonvideo.livingroom是电视应用程序。 -
将包名称设置为“com.amazon.avod.thirdpartyclient”不会启动已安装的主要视频应用程序。它仍在浏览器中打开。
-
请试试我的回答。
标签: android