【问题标题】:Is it possible to prevent the Google Play app from creating a shortcut of my App on install?是否可以阻止 Google Play 应用在安装时创建我的应用的快捷方式?
【发布时间】:2013-03-01 01:46:43
【问题描述】:

当您通过 Google Play 安装应用程序时,会在您的主屏幕上创建该应用程序的快捷方式。用户可以通过禁用 Google Play 应用程序中的“自动添加小部件”设置来防止这种情况发生。

从开发人员的角度来看,我想知道是否可以在我自己的应用程序中防止这种情况发生。是否有清单设置或其他内容告诉 Google 在安装时不要为我的应用创建图标?

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

【问题讨论】:

    标签: android google-play


    【解决方案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);
        }
    

    【讨论】:

      猜你喜欢
      • 2014-01-04
      • 1970-01-01
      • 1970-01-01
      • 2016-07-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多