I want to get sim serial number in codename one using Android native code, following is my native implementation class, I have also added permission in build hint, code doesn't give any error but return null
import com.codename1.impl.android.AndroidNativeUtil;
import android.telephony.TelephonyManager;
public class MyNativeImpl {
public String simID() {
TelephonyManager tMgr=(TelephonyManager) AndroidNativeUtil.getActivity().getSystemService("phone");
String SIMSerialNumber=tMgr.getSimSerialNumber();
return SIMSerialNumber;
}
public boolean isSupported() {
return true;
}
}
I have added this code,
if(!AndroidNativeUtil.checkForPermission(Manifest.permission.READ_PHONE_STATE, "This should be the description shown to the user...")){ your code here }
but getting error like
error: package Manifest does not exist if(!AndroidNativeUtil.checkForPermission(Manifest.permission.READ_PHONE_STATE, "App requires the permission to work properly")) ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error