【问题标题】:How to receive INSTALL_SHORTCUT broadcast on Android如何在 Android 上接收 INSTALL_SHORTCUT 广播
【发布时间】:2015-07-19 20:33:39
【问题描述】:

每次在主屏幕/午餐器上创建新快捷方式时,我都会尝试接收事件。在我的应用收到事件后,我想修改快捷方式。下面列出了我当前的配置,但我从未收到任何事件。

<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>

我的想法可行吗?

最好的问候, 安德烈

【问题讨论】:

    标签: android shortcut launcher receiver


    【解决方案1】:

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

    【讨论】:

    • 我删除了权限,但它仍然不起作用。我正在使用 android studios nexus 模拟器。
    【解决方案2】:

    我找到了。当我使用拖放创建快捷方式并从菜单中拖放时,不会发布任何 INSTALL_SHORTCUT 事件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-29
      相关资源
      最近更新 更多