1
インターネットアクセス権を使用するアプリケーションを作成しようとしていますが、API 23で動作させるのに問題があります。実行許可が必要であると理解しています。必要。 私は、このコードにつまずいた:android api23インターネット許可
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.READ_CONTACTS)
!= PackageManager.PERMISSION_GRANTED) {
// Already declined the permission
if (ActivityCompat.shouldShowRequestPermissionRationale(this,
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 for the first time
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.READ_CONTACTS},
REQUEST_CONTACTS);
// REQUEST_CONTACTS is an
// app-defined int constant. The callback method gets the
// result of the request.
}
} をこのウェブサイトから:https://www.numetriclabz.com/declaring-and-handling-permissions-since-android-api-23-tutorial-2/
問題は、私はインターネットを必要とするが、私はオンラインを見つけたすべての例は、連絡先、それは類似しているはずされているが、私は交換する場合には、 REQUEST_CONTACTS とREQUEST_INTERNETの間にエラーが発生しましたが、どうすればいいですか?
あなたの答えをありがとう、私はマニフェストの許可を追加する必要があります。
インターネット用に行う必要はありません。たとえば、連絡先や場所の読み取りなどの「危険な」アクセス許可の場合にのみ実行する必要があります。あなたの場合は、マニフェストにインターネット許可を追加する必要があります。ここをクリックしてください:https://developer.android.com/guide/topics/manifest/uses-permission-element.html –
どのようなエラーが表示されますか? – jaibatrik