0
私のアプリからolaアプリを開くためのString uriとは何ですか?アプリからolaアプリを開く方法は?
私はオラアプリがすでにインストールされている場合、あなたは最終的なコードは次のようになります
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.olacabs.customer");
if (launchIntent != null) {
startActivity(launchIntent);//null pointer check in case package name was not found
}
次のようにランチャーを呼び出すことができます。この
try {
pm.getPackageInfo("com.olacabs.customer",PackageManager.GET_ACTIVITIES);
} catch (PackageManager.NameNotFoundException e) {
try {
getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.olacabs.customer")));
} catch (android.content.ActivityNotFoundException anfe) {
getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=com.olacabs.customer")));
}
}
ありがとうGaneshそれはうまく動作します。 –