我更新了Android Studio以支持API 25并在项目中实现它.我也寻找不同的资源来找到我的问题的正确答案,但没有运气.首先,我需要说我在Android 6.0.1上使用Action和Nova Launcher测试应用程序(但谷歌应用程序正在运行).所以,我实施了AndroidManifest.xml:
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
Run Code Online (Sandbox Code Playgroud)
创建shortcuts.xml于xml- res.在那里,我输入:
<shortcut
android:shortcutId="sc1"
android:enabled="true"
android:icon="@drawable/ic_kalendar"
android:shortcutShortLabel="@string/shortcut_kalendar"
android:shortcutLongLabel="@string/shortcut_kalendar_long"
android:shortcutDisabledMessage="@string/message_off">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.ips.orto.MainActivity"
android:targetPackage="com.ips.orto" />
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.ips.orto"
android:targetClass="com.ips.orto.kalendar.Kalendar"/>
</shortcut>
<shortcut
android:shortcutId="sc2"
android:enabled="true"
android:icon="@drawable/ic_else"
android:shortcutShortLabel="@string/shortcut_else"
android:shortcutLongLabel="@string/shortcut_else_long"
android:shortcutDisabledMessage="@string/message_off">
<intent
android:action="android.intent.action.MAIN"
android:targetClass="com.ips.orto.MainActivity"
android:targetPackage="com.ips.orto" />
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.ips.orto"
android:targetClass="com.ips.orto.else.Something"/>
</shortcut>
Run Code Online (Sandbox Code Playgroud)
我尝试删除android:属性,仍然无法正常工作.此外,我添加android:exported="true"了Activity指向的内容Shortcuts,我没有shortcuts.xml在任何特殊的v-bucket中创建.有谁知道我做错了什么?