I'm working on an App that takes photos and scans NFC Tags. The NFC Tag scanning works fine until I take a photo (via camera intent).
What I do:
In onResume() I call setupForegroundDispatch() and in onPause() I call stopForegroundDispatch().
public static void setupForegroundDispatch(final Activity activity, NfcAdapter adapter) {
final Intent intent = new Intent(activity, activity.getClass());
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
final PendingIntent pendingIntent = PendingIntent.getActivity(activity, 0, intent, 0);
adapter.enableForegroundDispatch(activity, pendingIntent, null, null);
}
public static void stopForegroundDispatch(final Activity activity, NfcAdapter adapter) {
adapter.disableForegroundDispatch(activity);
}
To start the camera I call:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
imageCaptureUri);
intent.putExtra("return-data", true);
startActivityForResult(intent, PICK_FROM_CAMERA);
To sum it up:
What I tried
I think you may have run into this
NFC is not available when I opened camera
Maybe you should try with a different device, if you have one