Unique Device ID Node on Android doesn’t seem to work.
i am trying to get unique device ID , it works great on PC but on Android it always gives me the same code, i tested it on a couple of phones and tablet and they all have the same code. which makes it quite useless.
is there anyway to get a Unique ID for Android devices ? (preferably with blueprint)
Hi
I write a blueprint function in my blueprint helper function library to get device id with JNI in android. I replaced this function with get Unique device ID in my blueprints.
hi , i tried these code on our project and it works fine on PC, but on gearVR, everytime we run these, it said “unexpected error” and the game crashed. do you have any clue what could possibly cause this? we are using unreal 4.12 source compiled version.
Hi , after collecting thousands of data from our games downloads, I noticed that this function is causing lots of crashes in certain devices, which are 10% of all downloads.
I don’t have any device that gets a crash on this code if you have one, please help me to fix this bug.
I read your crash reports and it crashes on GetStringUTFLength function but we use this function two times in our code can you put some logs to see which one cause the crashes.
Please test below code on the device.
jsize len = 0;
if (str)
len = env->GetStringUTFLength(str);
if (len == 0)
{
// Try to get the wifi mac address.
// On some devices maybe it fails if the wifi is switched off.
jobject wifi_manager = env->CallObjectMethod(activity, mid,
env->NewStringUTF("wifi"));
mid = env->GetMethodID(env->GetObjectClass(wifi_manager),
"getConnectionInfo", "()Landroid/net/wifi/WifiInfo;");
jobject wifiinfo = env->CallObjectMethod(wifi_manager, mid);
mid = env->GetMethodID(env->GetObjectClass(wifiinfo),
"getMacAddress", "()Ljava/lang/String;");
str = (jstring)env->CallObjectMethod(wifiinfo, mid);
if (str)
len = env->GetStringUTFLength(str);
}
if (len == 0)
{
// TODO: If two above methods fail we must get the id from Android ID.
// This ID is very stable but it will be changed with every OS update.
//
}
// Same as before
Hi , thank you very much for your code, we are using it for 2 years. However, now we upgraded to 4.20 and we have a crash in this code. Could you please have a look at here?
WELL, I FOUND OUT THAT THIS FUNCTION WON’T WORK ANDROID SDK 6.0 AND ABOVE.
You need to request runtime permission but it is a terrible way to get device id. Since therefore Google doesn’t accept apks below Android SDK 8.0, this code is therefore useless at all. We had to switch to Unreal’s getDeviceIdentifier method. Our databases are messed up because of this, everyones device id has changed