安卓 7.1 应用快捷方式



我正在使用静态快捷方式,如下所示(快捷方式的一部分.xml(。

<shortcut
    android:shortcutId="Noraml"
    android:enabled="true"
    android:icon="@drawable/ic_t_voice_list"
    android:shortcutShortLabel="@string/sp_audio_effect_PrDdefault"
    android:shortcutLongLabel="@string/sp_audio_effect_PrDdefault">
    <intent
        android:action="com.app.shortcuts.IVRService"
        android:targetPackage="com.app.shortcuts"
        android:targetClass="com.app.shortcuts.AppService">
    </intent>
    <!-- If your shortcut is associated with multiple intents, include them
         here. The last intent in the list determines what the user sees when
         they launch this shortcut. -->
    <categories android:name="android.shortcut.conversation" />
</shortcut>

并在清单文件中如下所示。

<service
    android:name=".AppService"
    android:enabled="true" >
    <intent-filter>
        <action android:name="com.app.shortcuts.IVRService" />
        <action android:name="com.app.shortcuts.IVRRemoteService" />
    </intent-filter>
</service>

但是当我尝试通过快捷方式启动应用程序时,我收到"应用程序未安装"吐司。

快捷方式仅适用于活动吗?或者我们可以在不启动应用程序的情况下在后台申请服务吗?

快捷方式只能根据文档启动活动:

通过快捷方式,用户可以快速访问当前活动启动器中应用主要活动以外的活动。

他们无法启动服务。

相关内容

最新更新