J
Juhran
Guest
For some reason my java code can't be compiled. I wanted to detect my device id inside my extension:
Error:
Not sure why is'nt working :-/
Code:
public String imei()
{
//Get the instance of TelephonyManager
TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
//Calling the methods of TelephonyManager the returns the information
String IMEINumber=tm.getDeviceId();
return IMEINumber;
}
My Java file:J:\com.company.game\src\main\java\com\company\game\testclass.java:42: error: cannot find symbol
TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
^
symbol: method getSystemService(String)
location: class testclass
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: J:\com.company.game\src\main\java\com\company\game\Gamepad\Gamepad.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:com.company.game:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':com.company.game:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Code:
package ${YYAndroidPackageName};
import ${YYAndroidPackageName}.R;
import com.yoyogames.runner.RunnerJNILib;
import android.app.Activity;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.content.Context;
import android.util.Log;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
public class testclass {
public String imei()
{
//Get the instance of TelephonyManager
TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
//Calling the methods of TelephonyManager the returns the information
String IMEINumber=tm.getDeviceId();
return IMEINumber;
}
}