Last try - see if attached is working for "31". Have changed the Java code to be as follows:
B4X:NFCUtils(final Activity pActivity) { mActivity = pActivity; mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity); if (Build.VERSION.SDK_INT < 31) { mPendingIntent = PendingIntent.getActivity(mActivity, 0, new Intent(mActivity, mActivity.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); } else { mPendingIntent = PendingIntent.getActivity(mActivity, 0, new Intent(mActivity, mActivity.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 67108864); } }
@agraham , please comment if I have it...
here it is...More information needed as to what the error is. Post the log.
update what?Doesn't look like anything to do with NB6. Whatever arkom.CardReader is it looks like it needs an update.
arkom.CardReader as I just said - whatever it is. Presumably it is part of a library or something if the original example also throws this error. Android now requires an additional flag for PendingIntents.update what?
oh, thanksarkom.CardReader as I just said - whatever it is. Presumably it is part of a library or something if the original example also throws this error. Android now requires an additional flag for PendingIntents.
You don't. As I have said twice above some library needs updating to add an extra flag.what permission i need?
okI've poked around in the
You don't. As I have said twice above some library needs updating to add an extra flag.
I've poked around inside Tapcard.jar and the constructor for the call to PendingIntent.getActivity(...) in the NFCUtils class constructor needs needs FLAG_IMMUTABLE specifying to run on SDK31 and higher. I've no idea where Tapcard.jar comes from but whoever wrote it needs to modify it.
For God's sake I've just told you above exactly what is needed. Tapcard.jar needs modifying as I said. I think Johan Schoeman probably wrote it as it include the B4A wrapper class. He needs to modiy it.can you tell which libraries?
thanks, i missed it, i'll try to contact him and ask...For God's sake I've just told you above exactly what is needed. Tapcard.jar needs modifying as I said. I think Johan Schoeman probably wrote it as it include the B4A wrapper class. He needs to modiy it.
File.MakeDir(File.DirRootExternal,"/Zeev")
Zeev, you can try with the attached lib files (jar and xml). No idea if it will solve your problem. Have changed the constructor to be as follows:For God's sake I've just told you above exactly what is needed. Tapcard.jar needs modifying as I said. I think Johan Schoeman probably wrote it as it include the B4A wrapper class. He needs to modiy it.
NFCUtils(final Activity pActivity) {
int flags = Intent.FLAG_ACTIVITY_SINGLE_TOP;
if (Build.VERSION.SDK_INT >= 31)
flags |= 67108864; //FLAG_IMMUTABLE
mActivity = pActivity;
mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity);
mPendingIntent = PendingIntent.getActivity(mActivity, 0,
new Intent(mActivity, mActivity.getClass()).addFlags(flags), 0);
}
thank you JohanZeev, you can try with the attached lib files (jar and xml). No idea if it will solve your problem. Have changed the constructor to be as follows:
FLAG_IMMUTABLE:NFCUtils(final Activity pActivity) { int flags = Intent.FLAG_ACTIVITY_SINGLE_TOP; if (Build.VERSION.SDK_INT >= 31) flags |= 67108864; //FLAG_IMMUTABLE mActivity = pActivity; mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity); mPendingIntent = PendingIntent.getActivity(mActivity, 0, new Intent(mActivity, mActivity.getClass()).addFlags(flags), 0); }
first update: there was no error on compiling so seems to be finethank you Johan
i will go over the sample and hope it solves the issue
will of course revert and update
(hope you're well)
Update 2Zeev, you can try with the attached lib files (jar and xml). No idea if it will solve your problem. Have changed the constructor to be as follows:
FLAG_IMMUTABLE:NFCUtils(final Activity pActivity) { int flags = Intent.FLAG_ACTIVITY_SINGLE_TOP; if (Build.VERSION.SDK_INT >= 31) flags |= 67108864; //FLAG_IMMUTABLE mActivity = pActivity; mNfcAdapter = NfcAdapter.getDefaultAdapter(mActivity); mPendingIntent = PendingIntent.getActivity(mActivity, 0, new Intent(mActivity, mActivity.getClass()).addFlags(flags), 0); }
What is the "crash" message in the B4A log?Update 2
Seems there's a problem
I changed the sdk to 31 as I want it to be on Google store
I run the app from my main app as intent
On previous libs & sdk 30 it all worked perfectly, now with new libs and sdk 31 the app loads and crashes
I will change sdk back to 30 and check
Didn't check it yet properly...What is the "crash" message in the B4A log?
tapcard.Initialize("ips")
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?