While launching the app I have requested permission and the request permission popup shows but after the app crashed alert. when i clicked OK button in the crashed popup it disappears and the app work's good
regards...
here is my code
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Login);
Requestpermission();
}
private void Requestpermission()
{
if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadPhoneState) == Permission.Granted)
{
}
else
{
ActivityCompat.RequestPermissions(this, new String[] { Manifest.Permission.ReadPhoneState }, PERMISSION_REQUEST_CODE);
}
}
here is my image after app installed..........
after clicking Ok .........
LOG:
Error 5368 AndroidRuntime Caused by: java.lang.SecurityException: getDeviceId: Neither user 10321 nor current process has android.permission.READ_PHONE_STATE. at android.os.Parcel.readException(Parcel.java:1599) at android.os.Parcel.readException(Parcel.java:1552) at com.android.internal.telephony.ITelephony$Stub$Proxy.getDeviceId(ITelephony.java:4426) at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:731) at md57d354519be1a75e7f096fe21d2760d3a.Login_Activity.n_onCreate(Native Method) at md57d354519be1a75e7f096fe21d2760d3a.Login_Activity.onCreate(Login_Activity.java:31) at android.app.Activity.performCreate(Activity.java:6309) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)