[英]callback google play on installed app
We are creating an app where you can share an app, which sends the user to the google play store to download another app. 我们正在创建一个可以共享一个应用程序的应用程序,该应用程序会将用户发送到Google Play商店以下载另一个应用程序。 My question is, how can I know if some user actually downloaded and installed that app?
我的问题是,我怎么知道某个用户是否实际下载并安装了该应用程序? Is there a some sort of callback you get from the play store?
从Play商店获得某种回调吗?
Try calling startActivityForResult() with the Play Store intent. 尝试以Play商店意图调用startActivityForResult()。 Then, override the onActivityResult() method in your Activity and check if the app is installed.
然后,在Activity中重写onActivityResult()方法,并检查是否已安装该应用程序。 This might help: How to check programmatically if an application is installed or not in Android?
这可能会有所帮助: 如何以编程方式检查Android中是否安装了应用程序?
isAppInstalledBefore("com.example.anappblabla");
private boolean isAppInstalledBefore(String packageName) {
PackageManager pm = getPackageManager();
boolean installed = false;
try {
pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
installed = true;
} catch (PackageManager.NameNotFoundException e) {
installed = false;
}
return installed; //returns boolean
}
No, but: 不是,但:
What I would do is trying to get the package name (generally in the URL for example: https://play.google.com/store/apps/details?id= dev.laurentmeyer.contactautocompleteview of the target app (which is unique): something like dev.laurentmeyer.whateverApp
(it's the one I'm personally using). Then scan the installed apps with this Helper and you'll be sure if it has been installed or not. 我要做的是尝试获取程序包名称(例如,通常在URL中: https : //play.google.com/store/apps/details? id = dev.laurentmeyer.contactautocompleteview (目标应用程序的唯一名称) ):类似
dev.laurentmeyer.whateverApp
(这是我个人使用的),然后使用此Helper扫描已安装的应用程序,您将确定它是否已安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.