swetha swetha - 1 year ago 38
Android Question

Hi,In 6.0 Permission to make call is asking everytime

In 6.0 marshmallow, I want to add permission to making call. below code is working in all devices except Moto G, In Moto G permission is asking everytime when I start making call.

if(android.os.Build.VERSION.SDK_INT >= 23){
if(checkPermission(c, Manifest.permission.READ_PHONE_STATE)){
// success
// faliure

Answer Source

Create intent service like below and add your code in that

public class RSSPullService extends IntentService {
    protected void onHandleIntent(Intent workIntent) {
        // Gets data from the incoming Intent
        String dataString = workIntent.getDataString();
        // Do work here, based on the contents of dataString