我有两个不同的软件包名称(app ids)。这些应用程序适用于不同的用户“角色”。是否可以使用Google App Invites API从第二个应用程序发送邀请来安装/设置第一个应用程序?
答案 0 :(得分:0)
使用以下代码
String firstAppPackageName = ""; //package name of app
try {
PackageManager pm = getPackageManager();
try {
pm.getPackageInfo(firstAppPackageName, PackageManager.GET_ACTIVITIES);
Toast.makeText(this, "already Installed", Toast.LENGTH_SHORT).show();
} catch (PackageManager.NameNotFoundException e) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + firstAppPackageName));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
} catch (android.content.ActivityNotFoundException anfe) {
}