Started working with AppShortcuts, created everything as required by off-documentation:

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:targetApi="25"> <shortcut android:enabled="true" android:icon="@drawable/ic_category_transfer" android:shortcutId="shortcut_name" android:shortcutShortLabel="@string/common_transactions_add_transaction"> <intent android:action="android.intent.action.VIEW" android:targetClass=".LauncherActivity" android:targetPackage="com.sai.android"> </intent> <categories android:name="android.shortcut.conversation" /> </shortcut> 

Tested in the emulator, the icon with the text appears but when you try to navigate through this tab, it displays the text

App isn't installed

Although the application is installed. Maybe it's in the android:action attribute, since I still haven't figured it out with him.

    2 answers 2

    I answer the addition to the question:

    Well, I have this main activity, and I wanted to go into the fragment

    Since you have your main activity, thanks to it you can get into the desired fragment.

    First, it is worth all the same to make sure that the attributes are written correctly in shortcuts.xml . It will look something like this:

     <intent android:action="com.vm.sai.activities" android:targetClass="com.vm.sai.activities.MainActivity" android:targetPackage="com.vm.sai"> </intent> 

    And in your activity you will have to implement the following construction in the onCreate() method:

     if("com.vm.sai.activities".equals(getIntent().getAction())) { getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MainFragment()).commit(); } 

    And of course, make sure once again that in AndroidManifest.xml you have meta-data in your intent'e to have the main intent'e :

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

    Also for more detailed information:

    App Shortcuts ;

    ShortcutManager ;

    ShortcutInfo Builder .

    • one
      You need to be able to break such problems as the author into two: 1 - how to arrange a shortcut, so that intent runs the component I need, 2 - what to send in the intent, so that the component does something or displays it accordingly. - Eugene Krivenja
    • It is not clear if the author decided №1 to discuss №2. - Eugene Krivenja
    • @EugeneKrivenja completely agrees, but since the implementation is not bulk in general, I decided to answer two points at once. - Morozov
    • And if you throw everything in a heap, it turns out the magic of the type "I launch a fragment from a shortcut". - Eugene Krivenja
    • Thank you very much for the detailed answer, everything turned out. - Inkognito

    Check that the application package name in the manifest matches the

    android:targetPackage="com.sai.android"

    and here provide the full path to the class for loyalty

    android:targetClass=".LauncherActivity"

    • Well, I have this main activity, and I wanted to go into the fragment - Inkognito
    • And here it is? Shortcuts can only send intents, while intents are designed to activate activates. What have you got there, your care. - Eugene Krivenja
    • @EugeneKrivenja With your comment you are misleading a person, you might think that you can’t run a fragment. - Morozov
    • @Morozov, explain what you mean by "run fragment"? - Eugene Krivenja
    • one
      @Inkognito, no problem, just try to formulate the questions more specifically. It will be easier to answer. - Eugene Krivenja