如何在Android上接收INSTALL_SHORTCUT广播

时间:2015-07-19 20:33:39

标签: android shortcut launcher receiver

每次创建Homescreen / Luncher上的新快捷方式时,我都会尝试接收活动。我的应用收到活动后,我想修改快捷方式。我目前的配置如下所示,但我从未收到过活动。

<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />    
<uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
<application>
  <receiver  
     android:name=".InstallShortcutReceiver"
     android:permission="com.android.launcher.permission.INSTALL_SHORTCUT">
    <intent-filter>
      <action android:name="com.android.launcher.action.INSTALL_SHORTCUT" />
    </intent-filter>
  </receiver>
</application>

我的想法可能吗?

最诚挚的问候, 安德烈

2 个答案:

答案 0 :(得分:0)

如果从接收方删除权限行会怎样?您在接收器中指定的权限是调用它所需的权限,而不是它接收广播的权限。

答案 1 :(得分:0)

我找到了。当我使用drap和drop从菜单创建快捷方式时,不会发布INSTALL_SHORTCUT事件。