React native – Unable to use Permissionsandroid request location permissions

I tried to request runtime location permissions, but my promise kept throwing this exception:

“Trying to use the permissions API, but the host Activity is not implemented PermissionAwareActivity”

My code looks like this:

PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION)
.then((preGranted ) => {
console.log('pre-granted', preGranted)
if (!preGranted) {
PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{'title':'Enable location','message':'Boss said so..' }
)
.then((granted) => {
if (granted) {
console.log('GRANTED AFTER ASKING:', granted)
debugger
}
})
}
})

< p>In my list I have:

Someone met Have you been to the news? What is PermissionAwareActivity? I cannot find anything about it on the Internet.

What is PermissionAwareActivity

PermissionAwareActivity is an interface that helps you obtain runtime permissions. You must implement these methods in your own activities.

public interface PermissionAwareActivity {

int checkPermission(String permission, int pid, int uid);


int checkSelfPermission(String permission);
< br /> boolean shouldShowRequestPermissionRationale(String permission);

void requestPermissions(String[] permissions, int requestCode, PermissionListener listener);
}

I tried to request runtime location permissions, but my promise kept throwing this exception:

“Trying to use the permission API, but the host Activity does not implement PermissionAwareActivity”

My code looks like this:

PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION)
.then((preGranted) => {
console.log('pre-granted', preGranted)
if (!preGranted) {
PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{'title':'Enable location','message':'Boss said so..' }
)
.then((granted) => {
if (granted) {
console.log('GRANTED AFTER ASKING:', granted)
debugger
}
})
}
})

In my list I have:

 

Has anyone encountered that message? What is PermissionAwareActivity I cannot find anything about it on the Internet.

What is PermissionAwareActivity

< p>PermissionAwareActivity is an interface that helps you obtain runtime permissions. You must implement these methods in your own activities.

public interface PermissionAwareActivity {

int checkPermission(String permission, int pid, int uid);


int checkSelfPermission(String permission);

boolean shouldShowRequestPermissionRationale(String permission);

void requestPermissions(String[] permissions, int requestCode, PermissionListener listener);
}

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5908 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.