嗨,在6.0中打电话的许可每次都在询问

时间:2016-06-03 05:58:19

标签: android

在6.0棉花糖中,我想添加拨打电话的许可。以下代码适用于除Moto G以外的所有设备,In Moto G权限在每次开始拨打电话时都会询问。

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

1 个答案:

答案 0 :(得分:0)

创建如下所示的意向服务,并在其中添加代码

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