[問題] 內部app連結外部app問題
流程
優先
啟動已安裝外部app
否則
啟動Google Play 進行安裝
試過的可用方法
目前可啟動到Google Play
但安裝後卻也還是去到Google Play <= 想解決
理想狀況
程式優先順序
1.本身app內開啟已安裝外部app(未安裝程式就會程式Break 無法到第二程序判斷)
以上為問題點
使用方法為Intent getLaunchIntentForPackage
次要
2.開啟Google Play 進行安裝
相關程式碼附上
String sParam = "AppPackageName";
Intent intent;
try{
try{
intent = getPackageManager().getLaunchIntentForPackage("AppPackageName");
startActivity(intent);
}
// Open app with Google Play app
catch(android.content.ActivityNotFoundException anfe){
intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("market://details?id="+sParam));
startActivity(intent);
}
}
catch (android.content.ActivityNotFoundException anfe)
{
// Open Google Play website
intent = new Intent(Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id="+sParam));
startActivity(intent);
}
程式碼連結
https://gist.github.com/anonymous/e59d7c0f6b5e71159aea
一整天無解
還是Intent getLaunchIntentForPackage無法在這當中應用
請求大神幫忙解惑
謝謝!
--
當月不再圓
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 211.22.221.199
推
03/05 17:23, , 1F
03/05 17:23, 1F
已修改!抱歉
※ 編輯: Akiraevk 來自: 211.22.221.199 (03/05 17:45)
※ 編輯: Akiraevk 來自: 211.22.221.199 (03/05 17:47)
※ 編輯: Akiraevk 來自: 211.22.221.199 (03/05 18:08)
推
03/07 23:28, , 2F
03/07 23:28, 2F