问题
As you know, According to Google Developer policy if our core functionality of the app does not depends on SMS than we should remove RECEIVE_SMS android permission and try to find a different Alternative.
But my issue is I am not using RECEIVE_SMS in manifest or in asking Runtime. Still, Google warns me of using RECEIVE_SMS permission.
Though on play store If I check permissions required in this app it shows RECEIVE_SMS permission.
You can see some of the screenshots of my app where I searched for this permission if I am using it anywhere by mistake.
But I am unable to find it.
Also this one in manifest:
As you can see I am not asking for that permission nor in manifest or runtime.
I am using Firebase Phone authentication and PayUMoney Payment integration. Is it possible that these two might be causing issues? or they are internally asking for this permission.
I don't know from where this permission is coming from.
It would be a great help if anyone can help me with this issue.
anyone facing the same issue?
回答1:
Well, the issue is with PayUMoney library. Because Firebase Phone Auth is not asking for RECEIVE_SMS
permission.
What you can do is you can remove the library one by one and check if it is still asking for the RECEIVE_SMS
permission.
If you find which library is causing this then you can write this in your Android Manifest
<uses-permission
android:name="android.permission.RECEIVE_SMS"
tools:node="remove" />
This will prevent a library from asking this permission internally. Also please check if your library is functional without this permission after adding this line to your app manifest.
For your particular question, PayUMoney is causing this issue and not Firebase so you can add this line to your manifest. and check the PayuMoney is functional.
回答2:
Firebase Phone authentication will need to use SMS to authenticate you. So it is needed on your permission. That is why you have this error, this is a simple way of saying; please include SMS permissions.
And please you can try and use this library for easy permissions manipulation;
implementation 'gun0912.ted:tedpermission:2.2.2
And whenever you need permission just do;
` public class GrantPermisions {
public static void givePermision(final Context context){
PermissionListener permissionlistener = new PermissionListener() {
@Override
public void onPermissionGranted() {
}
@Override
public void onPermissionDenied(List<String> deniedPermissions) {
}
};
TedPermission.with(context)
.setPermissionListener(permissionlistener)
.setDeniedMessage("If you reject permission,you can not use this service\n\nPlease turn on permissions at [Setting] > [Permission]")
.setPermissions(Manifest.permission.INTERNET,
Manifest.permission.READ_SMS,
Manifest.permission.READ_CALL_LOG)
.check();
}
}`
Hope you fix it. Production awaits mate!!!
来源:https://stackoverflow.com/questions/53707033/receive-sms-permission-issue