NfcAdapter in c++ using QJniAndroidObject
-
Hello,
I'm kinda new to qt, so don't go to hard on me :D. I'm trying to develop an application for android that can scan mifare tags(1k 4k ultralight etc) and get the uid and sak of this cards. I know that you can use methods from qnearfieldmanager and qnearfieltarget and get the uid with target->getUid(), but the problem is that I don't know how to get the sak of this cards.
I have tried using QAndroidJni object to call a method from java class nfcAdapter->getSak().. The problem is that i need to get the context for the application, then the nfcAdapter with getDefaultAdapter(Context context) and after that i can call getSak..
The nfca adapter part i tried getting it with:
QAndroidJniObject nfca = QAndroidJniObject::callStaticObjectMethod("android.nfc.NfcAdapter","getDefaultAdapter","(Landroid/content/Context;)Landroid/nfc/NfcAdapter;");
But it gives me an JNI error: JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0xb5ffd99c. I have quest that i need the context to pass it as an argument for getDefaultAdapter(Context context).
Does anyone know a way on how to do this thing, expecially the sak part?