USB Permissions not received by Broadcast receiver - android

Good evening community, I am reaching with the hopes of being educated about the following problem.
My intention with this code is to be able to handle USB permission intents in a receiver registered in a manifest file. The receiver gets USB Attached and detached actions, but not USB permissions when the user either accepts or declines the prompt.
Here is the code for the manifest, receiver and an activity to send the permissions request to the USB manager. And Finally, my target SDK is 28.
Any help is very much appreciated. Thank you very much.
public class BroadcastReceiver extends android.content.BroadcastReceiver{
public static final String USB_DEVICE_ATTACHED = "android.hardware.usb.action.USB_DEVICE_ATTACHED";
public static final String USB_DEVICE_DETACHED = "android.hardware.usb.action.USB_DEVICE_DETACHED";
public static final String USB_PERMISSION ="com.android.example.USB_PERMISSION";
#Override
public void onReceive(Context context, Intent intent) {
Context applicationContext = context.getApplicationContext();
try{
if (intent != null) {
String action = intent.getAction();
if (!TextUtils.isEmpty(action)) {
if (action.equals(USB_DEVICE_ATTACHED) || action.equals(USB_PERMISSION)){
UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
UsbManager usbManager = (UsbManager) applicationContext.getSystemService(Context.USB_SERVICE);
if (action.equals(USB_DEVICE_ATTACHED)){
if (!usbManager.hasPermission(device)){
intent.setAction(USB_PERMISSION);
intent.putExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false);
intent.setClass(applicationContext, PermissionActivity.class);
applicationContext.startActivity(intent);
Toast.makeText(applicationContext, "Device Attached.", Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(applicationContext, "Permissions already assigned", Toast.LENGTH_LONG).show();
}
}
else if (action.equals(USB_PERMISSION)){
if (usbManager.hasPermission(device)){
Toast.makeText(applicationContext, "USB Permissions are granted.", Toast.LENGTH_LONG).show();
}
}
}
else if (action.equals(USB_DEVICE_DETACHED)) {
Toast.makeText(applicationContext, "Device Detached.", Toast.LENGTH_LONG).show();
}
}
}
}
catch(Exception e){
Toast.makeText(applicationContext, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
Here is the activity:
public class PermissionActivity extends android.support.v7.app.AppCompatActivity {
public static final String USB_PERMISSION ="com.android.example.USB_PERMISSION";
#Override
protected void onStart() {
super.onStart();
}
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
Context applicationContext = this.getApplicationContext();
Intent intent = getIntent();
if (intent != null )
{
if (intent.getAction().equals(USB_PERMISSION)){
if (!intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false )) {
UsbDevice device = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (device != null) {
UsbManager mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
PendingIntent mPermissionIntent = PendingIntent.getBroadcast(applicationContext, 0, new Intent(USB_PERMISSION), 0);
mUsbManager.requestPermission(device, mPermissionIntent);
Toast.makeText(applicationContext, "Requesting Permission", Toast.LENGTH_LONG).show();
}
}
}
}
finish();
}
#Override
protected void onResume() {
super.onResume();
}
}
And finally, the manifest file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.user.usbtest">
<uses-feature android:name="android.hardware.usb.host"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PermissionActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:excludeFromRecents="true"
android:exported="true"
android:noHistory="true"
android:process=":UsbEventReceiverActivityProcess"
android:taskAffinity="com.example.taskAffinityUsbEventReceiver"
android:theme="#style/Theme.AppCompat.Translucent">
<intent-filter>
<action android:name="com.android.example.USB_PERMISSION"/>
</intent-filter>
</activity>
<receiver android:name=".BroadcastReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"/>
<action android:name="com.android.example.USB_PERMISSION"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
</manifest>

I found the problem. Since Android 8.0, there are more restrictions with manifest-declared
broadcast receivers and the type of actions that can be received. The USB Permissions action is not part of the limited list of actions that can be received. Here are some links regarding this issue.
https://developer.android.com/guide/components/broadcasts#context-registered-recievers
https://developer.android.com/guide/components/broadcast-exceptions

Related

Android launch application multiple times on an NFC tag discovered

Android launch application multiple times on an NFC tag discovered. I tried using the answer in this link Android launch activity multiple times on an NFC tag. but it says resources not found.
I am reading the tag from a fragment. Any help.
This is my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.atsl.touch">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-feature android:name="android.hardware.nfc" android:required="true"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:launchMode= "singleInstance"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
this is my fragments onResume()
public void onResume() {
super.onResume();
Intent intent =getActivity().getIntent();
pendingIntent = PendingIntent.getActivity(getContext(), 0, intent, 0);
intentFilter = new IntentFilter[] { };
nfcAdapter = NfcAdapter.getDefaultAdapter(getContext());
String action = intent.getAction();
boolean cardMatched=false;
Tag tag=null;
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
Toast.makeText(getContext(),"Blahhhhh",Toast.LENGTH_LONG).show();
tag = (Tag)intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
tappedCard=new Card();
tappedCard.setCardId(MainActivity.bytesToHexString(tag.getId()));
//tag = (Tag)intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
String[] techList = tag.getTechList();
////////////+___________________________________________
////////////+___________________________________________
if(tag == null){
Toast.makeText(getContext(), "tag == null",Toast.LENGTH_SHORT).show();
}else{
Card cc=new Card();
String tagId= MainActivity.bytesToHexString(tag.getId());
cc.setCardId(tagId);
dbHelper=new DBHelper(getContext());
ArrayList<Card> checkList=dbHelper.getAllCards();
if(checkList.size()>0)
{
for(Card d:checkList)
{
if (cc.equals(d))
{
cardMatched=true;
Toast.makeText(getContext(), "Card Matched !!!!",Toast.LENGTH_SHORT).show();
showCardDetails(cc.getCardId());
break;
}
else
{
continue;
}
}
if (!cardMatched)
{
imgBusCard.setVisibility(View.GONE);
showDetails.setVisibility(View.VISIBLE);
Toast.makeText(getContext(), "Card Not Matched !!!!",Toast.LENGTH_SHORT).show();
CustomDialogAddCard customDialogAddCard =new CustomDialogAddCard(getActivity(),"T",cc);
customDialogAddCard.show();
showCardDetails(cc.getCardId());
}
}
else {
Toast.makeText(getContext(), "No cards found !!!!",Toast.LENGTH_SHORT).show();
CustomDialogAddCard customDialogAddCard =new CustomDialogAddCard(getActivity(),"T",cc);
customDialogAddCard.show();
showCardDetails(cc.getCardId());
}
}
}else{
Toast.makeText(getContext(),
"onResume() : " + action,
Toast.LENGTH_SHORT).show();
}
}
The problem is when i run the application and hold an nfc tag near the phone app starts a new instance of the application. it doesn't detect the tag in the initial instance.

How to make android application listen to specific NFC chip? [duplicate]

This question already has answers here:
How to use NFC ACTIONS
(5 answers)
Closed 3 years ago.
I'm creating application that do some action if hit NFC chip , I know the following information about NFC in Android please correct me if I am wrong
you can't register actions of the NFC to receiver in the manifest file , only activities .
each NFC chip has it's own unique id .
what I want to do is
while the Application is in the background or it's closed , if I hit NFC chip with id (ex 1234) my app lunched and do some action.
is that possible ?
if yes, how it can be achieved?
edit
here is my code , it does open when you check any NFC chip and get this action android.nfc.action.TECH_DISCOVERED
but when it open the action is android.intent.action.MAIN
MainActivity.java
public class MainActivity extends AppCompatActivity {
public static final String ACTION_CHECK_IN= "checked";
public static final String ACTION_CHECK_OUT= "unchecked";
private NfcAdapter mNfcAdapter;
boolean isCheckedIn = false;
private static final String TAG = "MainActivity";
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
isCheckedIn = Pref.getBoolean("check", false);
}
#Override
protected void onResume() {
super.onResume();
Log.d(TAG, "onResume() called with: " + "");
String action = getIntent().getAction();
if (action != null) {
Log.d("MainActivity", "onCreate(" + action + ")");
if (action.equals(NfcAdapter.ACTION_NDEF_DISCOVERED) || action.equals(NfcAdapter.ACTION_TAG_DISCOVERED) || action.equals(NfcAdapter.ACTION_TECH_DISCOVERED)) {
if (!isCheckedIn) {
isCheckedIn = true;
Pref.putBoolean("check", true);
Log.d("checking","IN");
} else {
isCheckedIn = false;
Pref.putBoolean("check", false);
Log.d("checking","Out");
}
}
}
if (!mNfcAdapter.isEnabled()) {
Toast.makeText(MainActivity.this, "Please open it ", Toast.LENGTH_SHORT).show();
}
/**
* It's important, that the activity is in the foreground.
* Otherwise an IllegalStateException is thrown.
*/
setupForegroundDispatch(this, mNfcAdapter);
}
#Override
protected void onPause() {
/**
* Call this before onPause, otherwise an IllegalArgumentException is thrown.
*/
stopForegroundDispatch(this, mNfcAdapter);
super.onPause();
}
#Override
protected void onDestroy() {
super.onDestroy();
}
public static void setupForegroundDispatch(Activity activity, NfcAdapter adapter) {
final Intent intent = new Intent(activity.getApplicationContext(), activity.getClass());
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
final PendingIntent pendingIntent = PendingIntent.getActivity(
activity.getApplicationContext(), 0, intent, 0);
IntentFilter[] filters = new IntentFilter[2];
String[][] techList = new String[][]{};
// same filter as manifest - action, category
filters[0] = new IntentFilter();
filters[0].addAction(NfcAdapter.ACTION_TAG_DISCOVERED);
filters[1] = new IntentFilter();
filters[1].addAction(NfcAdapter.ACTION_TECH_DISCOVERED);
adapter.enableForegroundDispatch(activity, pendingIntent, filters, techList);
}
public static void stopForegroundDispatch(Activity activity, NfcAdapter adapter) {
adapter.disableForegroundDispatch(activity);
}
}
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.srjo.pocnfcadapter">
<uses-permission android:name="android.permission.NFC" />
<uses-feature
android:name="android.hardware.nfc"
android:required="true" />
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/filter_nfc" />
</activity>
</application>
</manifest>
According the the Android Developer site, it is possible for your app to filter NFC intents such as ACTION_NDEF_DISCOVERED.
First register your app in the manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.survivingwithandroid.nfc" >
....
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain"/>
</intent-filter>
<manifest>
Then you should use foreground dispatch (foreground app). Finally you use NFCAdapter to read the content (onNewIntent).
I wrote a detailed posts about NFC if you like give a look.

Service doesnt start

in the below code i am trying to start a service as shown. but at run time
serviceCtrl.isMyServiceRunning()
returns false and the toast doesnt show up despite the service is added to the manifest file.
i am starting the service wrongly?! why the service does not start
code:
if (mIsBonded) {
mSB.append("Pairing Completed" + "\n");
Intent intSPPService = new Intent(getApplicationContext(), SPPService.class);
intSPPService.putExtra("key", "starting SPP Service");
startService(intSPPService);
ServiceCtrl serviceCtrl = new ServiceCtrl(getApplicationContext(), ActMain.class);
if (serviceCtrl.isMyServiceRunning()) {
Toast.makeText(getApplicationContext(), "Starting SPP Service", Toast.LENGTH_SHORT).show();
}
//mATRFCConn = new ATRFCConn();
//mATRFCConn.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
mSB.append("Pairing Failed" + "\n");
}
...
...
...
public boolean isMyServiceRunning() {
ActivityManager manager = (ActivityManager) this.mCtx.getSystemService(this.mCtx.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (this.mClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
service:
public class SPPService extends Service {
private final String TAG = this.getClass().getSimpleName();
final static String SPP_SERVICE_ACTION = "SPP_ACTION";
#Override
public void onCreate() {
Log.w(TAG, "onCreate");
super.onCreate();
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.w(TAG, "onStartCommand");
String str = intent.getStringExtra("key");
Log.v(TAG, "Act->Service : " + str);
return Service.START_NOT_STICKY;
}
#Override
public IBinder onBind(Intent intent) {
return null;
}
}
Update
at run time i receive
W/ActivityManager: Unable to start service Intent {
cmp=com.example.com.myapplication/com.example.com.servicebt_01.SPPService
(has extras) } U=0: not found
manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.com.servicebt_01" >
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme" >
<activity android:name=".ActMain" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<service
android:enabled="true"
android:name=".SPPService"
android:icon="#mipmap/ic_launcher"
android:label="#string/service_name"
>
</service>
Please check this answer :
Unable to start service Intent
It says you have not given the name of the service in the manifest correctly. Please verify it.
Try to enter the Service name along with the entire package name in which it is present.
Your service name in manifest is error,not
<service
android:name="SPPService"
android:icon="#mipmap/ic_launcher"
android:label="#string/service_name"
>
</service>
If your SSPService is located in your application package,you can specify it like this:
<service
android:name=".SPPService"
android:icon="#mipmap/ic_launcher"
android:label="#string/service_name"
>
</service>
If not,you should specify its full path.

How to detect USB device in Android

I have USB host android device for that I need to connect USB device. to detect usb device to host I written following code.
public class ReadData extends Activity {
UsbManager usbManager;
PendingIntent mPermissionIntent;
UsbDevice usbDevice;
Intent intent;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_read_data);
usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
final String ACTION_USB_PERMISSION =
"com.example.udevice.USB_PERMISSION";
IntentFilter filter = new IntentFilter("android.hardware.usb.action.USB_ACCESSORY_ATTACHED");
registerReceiver(mUsbReceiver, filter);
}
private static final String ACTION_USB_PERMISSION =
"com.example.udevice.USB_PERMISSION";
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ACTION_USB_PERMISSION.equals(action)) {
synchronized (this) {
usbDevice = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
usbManager.requestPermission(usbDevice, mPermissionIntent);
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
if(usbDevice != null){
//call method to set up device communication
int deviceId = usbDevice.getDeviceId();
int productId = usbDevice.getProductId();
Log.i("device id", "****"+deviceId);
Log.i("product id", "****"+productId);
}else{
Log.i("device id", "No USB device");
}
}
else {
Log.d("shiv", "permission denied for device ");
}
}
}
}
};
and manifest is like below:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.udevice"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature android:name="android.hardware.usb.host" />
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="15" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".ReadData"
android:label="#string/title_activity_heat_con" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="#xml/device_filter" />
</activity>
</application>
</manifest>
device_filter.xml
<resources>
<usb-device vendor-id="67b"
product-id="2303"/>
</resources>
in above xml file I added device attributes. I am expecting a broadcast intent whenever USB device connected to host device. but it is not happening. What is wrong with above code.
Thanks
shiv
I think you need to add:
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
It is described here
There is onething you are doing it wrong.
The vendor id and device id should be in decimals not in hex. For example, you need to define as follows
<resources>
<usb-device vendor-id="1659"
product-id="8963"/>
</resources>
I converted your device id and vendor-id from hex to decimal
Let me know if this helps

how to read a card ISODEP NFC

i have to write a simple app to read a ISO B card
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tag_viewer);
mTagContent = (LinearLayout) findViewById(R.id.list);
mTitle = (TextView) findViewById(R.id.title);
resolveIntent(getIntent());
}
void resolveIntent(Intent intent) {
// Parse the intent
String action = intent.getAction();
Log.e(TAG, "toto ");
if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
try{
myTag.connect();
if (myTag.isConnected()){
byte[] response = myTag.transceive(command);
//logText(new String(response));
Log.e(TAG, "Result " + response);
}
myTag.close();
}catch (IOException e) {
e.printStackTrace();
}
} else {
Log.e(TAG, "Unknown intent " + intent);
finish();
return;
}
}
my problem is i don't success to enter in the test if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)). I systematicaly have "Unknow intent".
concerning the manifest :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.nfc">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
>
<activity android:name="TagViewer"
android:theme="#android:style/Theme.NoTitleBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/nfc_tech_filter" />
</activity>
</application>
<uses-sdk android:minSdkVersion="9" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />
thanks for your help.
Your Problem seems to be, that you're calling resolveIntent in the onCreate Method.
This should do the Trick:
#Override
protected void onNewIntent(Intent pIntent) {
super.onNewIntent(pIntent);
resolveIntent(pIntent);
}
To get the Tag Object, I'm just using
Tag tagFromIntent = pIntent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
NfcA tag = NfcA.get(tagFromIntent);
in my onNewIntent-Method
Unfortunately I couldn't verify this for NfcB.
You need to create a NfcAdapter object
private NfcAdapter mNfcAdapter;
than associate the object with your NFC in the onCreate method
mNfcAdapter = NfcAdapter.getDefaultAdapter(this);
do some checks before start the application, to be sure that the phone has the NFC
if (mNfcAdapter == null) {
// Stop here, we definitely need NFC
Toast.makeText(this, "This device doesn't support NFC.", Toast.LENGTH_LONG).show();
finish();
return;
}
on the onResume method enable the Dispatch
#Override
public void onResume() {
super.onResume();
Intent intent = new Intent(activity.getApplicationContext(), activity.getClass());
PendingIntent pendingIntent = PendingIntent.getActivity(activity.getApplicationContext(), 0, intent, 0);
mNfcAdapter.enableForegroundDispatch(activity, pendingIntent, null, null);
}
on the onPause method disable the Dispatch
#Override
protected void onPause() {
mNfcAdapter.disableForegroundDispatch(activity);
}
finally override the onNewIntent method to handle the intent
#Override
protected void onNewIntent(Intent intent) {
//handle intent here
}
in your case call "resolveIntent(intent)" inside the onNewIntent method
than follow this post to handle the IsoDep tag: Read data from NFC tag (IsoDep)

Categories

Resources