Hello, I want to access to the information of a NFC tag. For now, I can access the tag, but I don’t know how to get the messages from the Intent because the return type is an array.
var mActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic.<AndroidJavaObject>("currentActivity");
var mIntent = mActivity.Call.<AndroidJavaObject>("getIntent");
var sAction = mIntent.Call.<String>("getAction");
if(sAction=="android.nfc.action.NDEF_DISCOVERED")
{
var mNdefMessage = mIntent.Call.<AndroidJavaObject>("getParcelableArrayExtra", "android.nfc.extra.NDEF_MESSAGES");
}
How can I get an array from an AndroidJavaObject call? Any idea?
i’m trying tu use your code which looks great and usefull but my unity application never read any information from a NFC tag coul’d you please
share the android Manifest part and confirm that this code should read tag value at runtime ?
oh and my android device run a browser because i try to read an URL is that a problem for unity ?
One more thing to take care of is which tags did he buy and what android is he using. There maybe disparity in reading frequency. So jsr2k1 can you tell us what android device are you using ? and from where did you buy nfc tags?