when I create the method output error "ContextCompat does not exist in the current context" and a "PackageManager does not contain definition PERMISSION_GRANTED" .. know if I should add any special directive. Thank you
METHOD
private void CheckSMSStatePermission()
{
int PermissionCheck = ContextCompat.CheckSelfPermission(this, Manifest.Permission.SendSms);
if (PermissionCheck != PackageManager.PERMISSION_GRANTED)
{
Toast.MakeText(Activity, "No se tiene permiso para enviar SMS.", ToastLength.Short).Show();
ActivityCompat.requestPermissions(this, new String[] { Manifest.Permission.SendSms }, 1);
}
else
{
Toast.MakeText(Activity, "Se tiene permiso para enviar SMS!", ToastLength.Short).Show();
}
}
Error 1
Severity Code Description Project Project category Path File Line Column
Category Source Status deleted Tool
Error CS1503 Argument 1: can not be converted from
'LoginSystem.Authorization' to 'Android.Content.Context' LoginSystem 1 C: \
Users \ Lenovo \ documents \ visual studio 2017 \ Projects \ LoginSystem \
Documents \ visual studio 2017 \ Projects \ LoginSystem \ LoginSystem \
Authorization.cs 229 70 Active Compiler IntelliSense Compiler
Error 2
Severity Code Description Project Project category Path File Line Column
Category Source Status deleted Tool
CS0117 'PackageManager' no contiene una definición para
'PERMISSION_GRANTED' LoginSystem 1 C:\Users\Lenovo\documents\visual
studio 2017\Projects\LoginSystem\LoginSystem
C:\Users\Lenovo\documents\visual studio
2017\Projects\LoginSystem\LoginSystem\Autorizacion.cs 230 51 Compiler
IntelliSense Activo Compilador
change this
to this
or try this
add this permission in manifest file