Android Permissions with Google Play Permissions policy

4

I want to comment this time and ask for your collaboration in Android, since last year 2018, I have received messages from Google about an application that I have in the playstore that I use to send SMS to a GPS device.

Apparently Google changed the policies to use these permissions:

READ_SMS, WRITE_SMS, RECEIVE_SMS, SEND_SMS

Use the SMS permission or call log groups Google Play restricts the use of sensitive or high-risk permissions , such as permission groups. a href="https://support.google.com/googleplay/android-developer/answer/9047303"> SMS or call log.

The message came as 2 times is the following: Message gmail

The thing is that I have sent the appeal form explaining that my App depends on sending and receiving SMS, and they reject me saying that these permissions are reserved only for specific developers.

THE POINT IS: I need help to have if from the programming I can request these permissions dynamically, or how to do so that my App can send and read SMS, as before,  and compatible with Android 5.0 + versions

Apparently Google will eliminate this year all App Playstore that send SMS and are not on your list of allowed apps to send SMS.

I appreciate any help on the subject of sending SMS and reading on Android, compatible with the new google policies.

    
asked by YoGo 04.01.2019 в 17:47
source

1 answer

3

Remember that as of Android 6.0 (API level 23), users grant permissions ( risky permissions to apps while running, not when they install the app.

In the case of permissions related to the SMS messages :

These are considered risky permissions

  

risky permissions may allow the app to access information   confidential of the user. If your app has a normal permission in its   manifest, the system grants permission automatically. If you have   a dangerous permit, the user must explicitly authorize your   app.

therefore must be manually requested at runtime

This is an example, you can request permissions within the onCreate() method of your main Activity:

@Override
protected void onCreate(Bundle savedInstanceState) {
    ...
    ...

    ActivityCompat.requestPermissions(this,
            new String[]{Manifest.permission.READ_SMS,Manifest.permission.RECEIVE_SMS,Manifest.permission.SEND_SMS},
            255);

     ...
     ...
    }

and add the onRequestPermissionsResult() method:

@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    switch (requestCode) {
        case 255: {
            if (grantResults.length > 0
                    && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            } else {
                Toast.makeText(this, "Permiso denegado", Toast.LENGTH_SHORT).show();
            }
            return;
        }
    }
}

This way, when starting the application, the permissions will be required:

    
answered by 04.01.2019 в 23:34