LoginSignup
49
25

More than 5 years have passed since last update.

Android でインターネットに接続するためのパーミッションを設定する

Posted at

Android 上でインターネットに接続するためには、そのためのパーミッションを必要とする。

app/src/main/AndroidManifest.xml に以下を記述する

AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />

android:name で発行するパーミッションを指定する。今回はインターネット接続のためのものなので、android.permission.INTERNET となっている。

以下は、実際のAndroidManifest.xml

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.karuran.try_volley" >

    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
49
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
49
25