答えて

0

ユーザーがバージョン6.0でTelephonyManagerの許可を得ているかどうかを確認する必要があります。アプリがユーザーの連絡先の読み取り権限を持っており、必要に応じて権限を要求する場合は、次のコードをチェック詳細link

を確認することができます。

// Here, thisActivity is the current activity 
if (ContextCompat.checkSelfPermission(thisActivity, 
      Manifest.permission.READ_CONTACTS) 
    != PackageManager.PERMISSION_GRANTED) { 

// Should we show an explanation? 
if (ActivityCompat.shouldShowRequestPermissionRationale(thisActivity, 
     Manifest.permission.READ_CONTACTS)) { 

    // Show an expanation to the user *asynchronously* -- don't block 
    // this thread waiting for the user's response! After the user 
    // sees the explanation, try again to request the permission. 

} else { 

    // No explanation needed, we can request the permission. 

    ActivityCompat.requestPermissions(thisActivity, 
      new String[]{Manifest.permission.READ_CONTACTS}, 
      MY_PERMISSIONS_REQUEST_READ_CONTACTS); 

    // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an 
    // app-defined int constant. The callback method gets the 
    // result of the request. 
} 

}

+0

@usha:uはそれを確認しました – DKV

+0

ユーザーが許可を与えた場合、彼の連絡先にはどうすれば – Usha

+0

@ Ushaにアクセスできますか?以下のバージョンと同じです。 – DKV

関連する問題