Hello there :D
Im trying to use this code on my proyect
Its for getting the serial number from a device
here is the Java Code
String serial = null;
try { Class<?> c = Class.forName("android.os.SystemProperties"); Method get = c.getMethod("get", String.class); serial = (String) get.invoke(c, "ril.serialnumber"); } catch (Exception ignored) {
}
So far I got this
String Serial = "n/a";
try
{
var c = Class.ForName("android.os.SystemProperties");
var get = c.GetMethod("get");
var serial = (string)get.Invoke(c, "ril.serialnumber");
Serial = serial;
}
catch (Exception ex)
{
}
but I keep getting an exception at this line
var get = c.GetMethod("get");
Am I missing something???
I tried replacing it with this
var get = c.GetMethods().FirstOrDefault(x => x.Name == "get");
and that got rid of the exception but returned an empty serial