Android app shortcuts not working

I updated Android Studio to support API 25 and implemented it in a project. I am also looking for various resources to find the right answer to my question, but no luck. First, I need to say that I am testing the application on Android 6.0.1 using Action and Nova Launcher (but Google applications work). So, I implemented in AndroidManifest.xml:

            <meta-data
            android:name="android.app.shortcuts"
            android:resource="@xml/shortcuts" />

Created shortcuts.xmlin xml- res. There I enter this:

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

I am trying to remove attributes android:in attributes that still do not work. In addition, I add android:exported="true"in Activitywhich point to Shortcuts, and I did not create shortcuts.xmlin any special v-bucket. Does anyone know what I'm doing wrong?

+4
2

, . . :

<activity ...>
<meta-data 
    android:name="android.app.shortcuts"     
    android:resource="@xml/shortcuts"/></activity>

meta application Mainfest, Activity, shortcuts.xml (, ThirdActivity, Activity Manifest). , :

android:exported="true"

Action, Nova Launcher, Android 7.1.

+1

Source: https://habr.com/ru/post/1659434/


All Articles