私はAmazonのアプリケーションをプログラムで開こうとしていますが、それが電話で見つからない場合、ユーザーはプレイストアからインストールするように求められますが、問題はプレイストアで開くときに表示されていることですItem not found
エラーです。プレイストアで「Amazon」アプリをプログラムで開くにはどうすればいいですか?
は、ここに私のコードです:
public void openApp(final String packageName, final String appName) {
Intent intent = getBaseContext().getPackageManager().getLaunchIntentForPackage(packageName);
if (intent != null) {
startActivity(intent);
} else {
AlertDialog.Builder builder;
builder = new AlertDialog.Builder(MainActivity.this);
builder.setMessage(appName + " not found. Would you like to install " + appName + " from play store?")
.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName)));
}
}
})
.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.show();
}
}
packageName
はin.amazon.mShop.android.shopping
あるとappName
はAmazon
です。
私はここで間違って何が起こっている、アプリのplaystoreのリンクから、すなわち、https://play.google.com/store/apps/details?id=in.amazon.mShop.android.shopping&hl=en
をパッケージ名を持っているし、どのデバイスでI playstoreに成功したオープンアマゾンアプリを見つけたことができない場合は?
私はちょうどあなたのコードでチェックして、私のためにPlayストアのamazonアプリを読み込みます。ここに投稿したのと同じパッケージ名を渡してもよろしいですか?すなわちin.amazon.mShop.android.shopping?そこにタイプミスがないことを確認してください。 –
@ sam_0829私の別の愚かな間違い。ありがとう! –