首页 文章

跟踪从移动浏览器收到的应用安装

提问于
浏览
0

我有一个移动网络应用程序(在Android 's browser, not a native one), that redirects the user to Google' s Play商店中打开(适用于应用程序安装) . 我想跟踪应用程序安装(假设用户打开了Google Play的原生应用程序,而不是Google Play),知道我是推荐人安装 . 我找到了一个解决方案herehere,但他们都在从原生Android应用程序中引用Google Play . 我们是否有跟踪移动浏览器引用的应用程序安装的解决方案?

1 回答

  • 0

    由于您使用的是应用程序来显示网页,因此您可以使用同一个应用程序获取已安装的应用程序列表:

    试试这个 :

    final PackageManager pm = getPackageManager();
        // get a list of installed apps.
        List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
    
        for (ApplicationInfo packageInfo : packages) {
            if (pm.getLaunchIntentForPackage(packageInfo.packageName) != null) {
                Log.d(TAG, "Installed package :" + packageInfo.packageName);
                String applicationName = (String) (packageInfo != null ? pm.getApplicationLabel(packageInfo)
                        : "(unknown)");
                Log.d(TAG, "Launch Name :" + applicationName);
            }
        }
    

    因此,在启动游戏之前,您可以维护所有应用程序的列表 . 然后它返回到您的应用程序,您可以再次扫描并检查是否已安装该应用程序 .

    或者你可以实施

    Android receiver example for package install/remove/replace

相关问题