- Intent intent = new Intent(mainActivity.getApplicationContext(), mainActivity.getClass());
- intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
- PendingIntent pendingIntent = PendingIntent.getActivity(mainActivity, 0, intent, 0);
-
- IntentFilter tech = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
- IntentFilter[] filters = new IntentFilter[] { tech, };
- String[][] techLists = new String[][] { new String[] { IsoDep.class.getName(), NfcA.class.getName() } };
-
- oAdapter.enableForegroundDispatch(AppContext.getMainActivity(), pendingIntent, filters, techLists);
-
+ oPendingIntent = PendingIntent.getActivity(mainActivity, 0, new Intent(mainActivity, mainActivity.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
+ IntentFilter techDiscovered = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
+ aFilters = new IntentFilter[]{techDiscovered};
+ aTechLists = new String[][]{new String[]{IsoDep.class.getName()}};