- Home /
u3d NFC Flash back
Every time after identification, will flash back;;
================
void Update()
{
try
{
AndroidJavaObject mActivity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject mIntent = mActivity.Call<AndroidJavaObject>("getIntent");
AndroidJavaObject[] mNdefMessage = mIntent.Call<AndroidJavaObject[]>("getParcelableArrayExtra", "android.nfc.extra.NDEF_MESSAGES");
text = mNdefMessage == null ? "fuck" : "ok";
if (mNdefMessage != null)
{
AndroidJavaObject[] mNdefRecord = mNdefMessage[0].Call<AndroidJavaObject[]>("getRecords");
byte[] payLoad = mNdefRecord[0].Call<byte[]>("getPayload");
text1 = System.Text.Encoding.UTF8.GetString(payLoad);
Debug.Log("---->" + text);
}
}
catch (Exception ex)
{
text1 = ex.Message;
}
}
============================= XML
AndroidManifest.xml
=============
Uhm, ... what does "flash back" mean? What happens? What got executed? Any exception? You have to give way more information. What are you actually trying to communicate with?
Also i've formatted your code. You have to keep an empty line before and after the code block. I've also removed the only tag "light" (which makes no sense) and aded some proper tags.
Your answer
Follow this Question
Related Questions
JNI Exception using Android Plugin 1 Answer
How to call an android notification plugin if it's not the main activity? 1 Answer
How does UnityEngine.AndroidJNISafe work? Is there some Reference? 1 Answer
CreateJavaRuntime problem 0 Answers
[Android] Call .jar function on render thread using JNI 0 Answers