android - error permision ACCESS_FIND_LOCATION -




i'm using permission access_fine_location when run.error:requires access_fine_location permission why?

thanks in advance.

<uses-permission android:name="android.permission.access_fine_location"/> 

access_fine_location , access_coarse_location both permission required when trying location add both permission in manifest file if targeting android 6.0 , above add runtime permsiion below code

   string permission = android.manifest.permission.access_fine_location;             if (activitycompat.checkselfpermission(searchcityclass.this, permission)                     != packagemanager.permission_granted && activitycompat.                     checkselfpermission(searchcityclass.this, android.manifest.permission.access_coarse_location)                     != packagemanager.permission_granted) {                 activitycompat.requestpermissions(searchcityclass.this, new string[]                         {permission}, permission_gps_code);              } 

now handle permisiion result

@override public void onrequestpermissionsresult(int requestcode, @nonnull string[] permissions,                                        @nonnull int[] grantresults) {     super.onrequestpermissionsresult(requestcode, permissions, grantresults);     if (requestcode == permission_gps_code) {         if (grantresults[0] == packagemanager.permission_granted) {               toast.maketext(this, "location_permission_granted ", toast.length_short).show();          } else {              toast.maketext(this, "location_permission_not_granted ", toast.length_short).show();         }     }  } 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -