Currently I am working with nfc reader. In this application nfc read tags and redirect to specific activity. But I want to redirect when user in background or app in kill state.
my manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.adsmn.nfsreader">
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
<uses-permission android:name="android.permission.NFC" />
<application
android:hardwareAccelerated="false"
android:largeHeap="true"
android:allowBackup="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:roundIcon="@drawable/app_icon"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Activity.Event_Executed"
android:screenOrientation="landscape"></activity>
<activity android:name=".Activity.VideoViewActivity"
android:screenOrientation="landscape"/>
<activity
android:launchMode="singleTask"
android:name=".Activity.Tech_Activation_Activity"
android:screenOrientation="landscape" />
<activity android:name=".Activity.MainActivity"
android:launchMode="singleTask"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<action android:name="android.nfc.action.ACTION_TAG_DISCOVERED" />
<data android:mimeType="text/plain" />
</intent-filter>
<!-- no need to use this when user to open deafualt app-->
<!-- <meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />-->
</activity>
<activity android:name=".Activity.ViewPaigerClass"
android:launchMode="singleTask"
android:screenOrientation="landscape"></activity>
</application>
I have all ready tried some answer from stack overflow but none of them worked, So please tell me some thing that what I am doing wrong. Thanks in advance
You need to use deeplink for launching a specific Activity or Fragment.
And make your activity android:launchMode="singleTop"
Here is the reference for how to make deeplink.
For the fragment, you'd better to check Navigation Component .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.