Added static shortcuts android
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
@Peretz30 any updates?
@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.