Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Added static shortcuts android #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Peretz30
Copy link

Resolves #98 To create static shortcuts, follow Android Docs
But! I didn't figure out how to make it work with cold start. It works when app is in foreground, but if you close app and try to start with quick action, when callback is not called. I think its connected with MainActivity and it's Intent and could be fixed with right config in shortcuts.xml. But I can't succeed with that. My shortcuts.xml looks like this:

<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
  <shortcut
    android:shortcutId="newBusinessTrip"
    android:shortcutShortLabel="@string/newBusinessTrip">
    <intent
    android:action="android.intent.action.MAIN"
      android:targetPackage="com.example.myapplication"
      android:targetClass="com.example.myapplication.MainActivity"
    />
    <intent
      android:action="ACTION_SHORTCUT_STATIC"
      android:targetPackage="com.example.myapplication"
      android:targetClass="com.example.myapplication.MainActivity"
      >
      <extra
            android:name="SHORTCUT_ITEM_TYPE"
            android:value="newBusinessTrip" />
            <extra
            android:name="SHORTCUT_ITEM_TITLE"
            android:value="test" />
      </intent>
  </shortcut>
  <!-- Specify more shortcuts here. -->
</shortcuts>

Your package name instead com.example.myapplication

@artklen
Copy link

artklen commented Oct 14, 2021

@Peretz30 any updates?

@anatooly
Copy link

anatooly commented Mar 13, 2023

@Peretz30 I think this doesn't work on last RN 0.71 I use your fork and code
QuickActions.popInitialAction().then(onAction).catch(console.error) onAction not called.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android static App shortcuts
3 participants