![](/img/trans.png)
[英]how to launch amazon prime video app on android TV using Intent
[英]how launch amazon prime video app from within my android app using intent
我正在創建一個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();
}
}
嘗試使用以下意圖
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.amazon.avod.thirdpartyclient");
startActivity( launchIntent );
如果找不到此意圖,那么您將獲得異常。 如果出現異常,則在catch塊中打開url。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.