是否有可能阻止谷歌Play应用程序从安装创建我的应用程序的快捷方式?(Is it possible

2019-08-17 13:14发布

当你通过谷歌播放安装应用程序时,您的主屏幕上创建的应用程序的快捷方式。 用户可以防止这种通过禁用“自动添加窗口小部件”的谷歌Play应用程序中设置发生。

从开发者的角度来看,我不知道是否有可能以防止这种情况我自己的应用程序中。 是否有一个明显的设置还是其他什么东西,告诉谷歌没有创建我上安装的应用程序的图标?

由于没有启动的活动是不是我的应用程序的选项。

Answer 1:

http://viralpatel.net/blogs/android-install-uninstall-shortcut-example/本教程是用于添加或删除网页的快捷方式非常有用

从主屏幕类似卸载快捷方式安装,卸载或删除的Android快捷使用一个Intent(UNINSTALL_SHORTCUT)来执行任务。 在下面的代码,我们删除主屏幕上添加快捷方式。

同样,我们需要执行卸载快捷方式的任务权限。 添加以下权限到Android清单XML。

private void removeShortcut() {

        //Deleting shortcut for MainActivity 
        //on Home screen
        Intent shortcutIntent = new Intent(getApplicationContext(),
                MainActivity.class);
        shortcutIntent.setAction(Intent.ACTION_MAIN);

        Intent addIntent = new Intent();
        addIntent
                .putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
        addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "HelloWorldShortcut");

        addIntent
                .setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
        getApplicationContext().sendBroadcast(addIntent);
    }


文章来源: Is it possible to prevent the Google Play app from creating a shortcut of my App on install?