Skip to content

Instantly share code, notes, and snippets.

@xvadsan
Created November 12, 2020 07:54
Show Gist options
  • Save xvadsan/e2dc3ac09e8df5b177b2baa3640545a9 to your computer and use it in GitHub Desktop.
Save xvadsan/e2dc3ac09e8df5b177b2baa3640545a9 to your computer and use it in GitHub Desktop.
shortcuts
1) in manifest in main activity
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
2) shortcuts.xml
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_write_menu"
android:shortcutId="writeId"
android:shortcutLongLabel="@string/main_menu_write_rfid"
android:shortcutShortLabel="@string/main_menu_write_rfid">
<intent
android:action="android.intent.action.VIEW"
android:data="moneybook://write_deeplink"
android:targetClass="tech.dcloud.erfid.ugrokit.ui.main.MainActivity"
android:targetPackage="tech.dcloud.erfid.ugrokit" />
</shortcut>
</shortcuts>
3) main_graph.xml
<fragment
android:id="@+id/osFragment"
android:name="tech.dcloud.erfid.ugrokit.ui.os.OsFragment"
android:label="OsFragment"
tools:layout="@layout/fragment_os">
<deepLink app:uri="moneybook://write_deeplink" />
</fragment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment