android - 7.1 之前的设备中未显示静态快捷方式

标签 android android-launcher

我刚刚实现了 3 个静态快捷方式,它们在 android 7.1 中运行良好,符合预期。但是,使用静态快捷方式,我希望它们也可以在带有 Nova Launcher 的 Android 7.0(或 6,未尝试)的设备上工作,但它们没有出现。为什么?这是我为其中一个编写的代码:

    <shortcut
        android:shortcutId="ND Fragment"
        android:enabled="true"
        android:icon="@drawable/icon_filter"
        android:shortcutShortLabel="@string/title_nd"
        android:shortcutLongLabel="@string/title_nd">
        <intent
            android:action="android.intent.action.VIEW"
            android:targetPackage="com.gmail.nellorocca.dslrtools"
            android:targetClass="com.gmail.nellorocca.dslrtools.MainActivity">
            <extra android:name="extra_name" android:value="launch_nd"/>
        </intent>

        <categories android:name="android.shortcut.conversation" />
    </shortcut>

最佳答案

感谢 Chris Lacy(Action Launcher 的开发人员)指南,解决了这个问题。 您需要在您指向的任何 Activity 中添加 android:exported=true。

来源:http://theblerg.net/post/2016/10/1/integrating-android-71s-launcher-shortcuts-into-your-app

关于android - 7.1 之前的设备中未显示静态快捷方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43156467/

相关文章:

android - 重建 Android Instant App 后,使用功能模块中基本模块中定义的颜色失败

Android Home Activity 启动子 Activity

android - 用动画设置位置

android - 如何使 UI 在横向模式下看起来相同?

android - android的应用程序屏幕如何恢复正在运行的 Activity ?

android - 更新后如何自动打开启动器应用程序?

java - 有没有一种方法可以监听和检测安装和卸载?

android - 导航组件 SingleTask 启动 fragment 导航

android - ViewPager 不会立即更新 textview 字体大小

Android:使用电子邮件 Intent 发送电子邮件,可以在发送前更改消息吗?