Android Ultimate Plugin – Android Manifest Permission 101

Hi Ladies and Gentlemen, Today we will focus on Android Manifest Permission because yeah some people find it difficult to deal with so here it is.

Note: some features does need a permission.

below is our Android Manifest File used in Android Ultimate Plugin most the permission is commented to aid you.

Note: Please place your permissions before Application tag not after to avoid permission errors

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
  	<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  
  	<uses-sdk android:minSdkVersion="9"/>  
  	<uses-permission android:name="android.permission.INTERNET" />
  	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  	<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
  	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  
  	<uses-permission android:name="android.permission.GET_TASKS"/>
  
  	<!--for flash light-->
  	<uses-permission android:name="android.permission.FLASHLIGHT"/>       
  	<uses-permission android:name="android.permission.CAMERA"/>
  	<uses-feature android:name="android.hardware.camera"/>
  	<uses-feature android:name="android.hardware.camera.autofocus" />
  	<uses-feature android:name="android.hardware.camera.flash" />    
  	<!--for flash light-->
  
  	<!--Camera-->
  	<!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
  	<!--<uses-permission android:name="android.permission.CAMERA" />-->
  	<!--<uses-feature android:name="android.hardware.camera" />-->
  	<!--<uses-feature android:name="android.hardware.camera.autofocus" />-->
  	<uses-feature android:name="android.hardware.camera.front" android:required="false" />
  	<!--Camera-->
  
  	<!--Vibration-->
  	<uses-permission android:name="android.permission.VIBRATE"/>
  	<!--Vibration-->
  
  	<!--RecordAudio also used by SpeechRecognizer-->
  	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  	<uses-permission android:name="android.permission.RECORD_AUDIO" />
  	<!--RecordAudio--> 
  
  	<!--GPS-->
  	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
  	<!--GPS-->
  
  	<!--BlueTooth-->
  	<uses-permission android:name="android.permission.BLUETOOTH"/>
  	<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
  	<!--BlueTooth-->
  
  	<!--AlarmClock-->
  	<uses-permission android:name='android.permission.WAKE_LOCK'/>
  	<!--AlarmClock-->  	
  
  	<!--wifi state -->
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  	<!--wifi state -->
  
  	<!--DeviceInfo-->
	<uses-permission android:name="android.permission.READ_PHONE_STATE" />    
	<!--DeviceInfo-->

	<!--Account-->
	<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
	<!--Account-->

	<!--ContactInfo-->    
	<uses-permission android:name="android.permission.READ_CONTACTS"/>
	<uses-permission android:name="android.permission.READ_PROFILE"/>	    
	<!--ContactInfo-->
  
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name" android:launchMode="singleTask" android:configChanges="orientation">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      
      	<!--Google indexing-->
	    <intent-filter>
	    <action android:name="android.intent.action.VIEW"/>
	    <category android:name="android.intent.category.DEFAULT"/>
	    <category android:name="android.intent.category.BROWSABLE"/>
	    <data android:scheme="https"
	          android:host="play.google.com"
	        android:pathPrefix="/store/apps/details?id=com.gigadrillgames.androidultimateplugin"/>
	    </intent-filter>
	    <!-- Accept adb data flag -->
	    <intent-filter>
	        <action android:name="android.intent.action.VIEW"/>
	        <category android:name="android.intent.category.DEFAULT"/>
	        <category android:name="android.intent.category.BROWSABLE" />
	        <data android:scheme="https"
	              android:host="play.google.com/store/apps/details?id=com.gigadrillgames.androidultimateplugin"/>
	    </intent-filter>
	    <!--Google indexing-->
      
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
    </activity>    
    
    <!--for local notification  -->
    <receiver android:name="com.gigadrillgames.androidplugin.notification.NotificationPublisher" />
    <!--for local notification  -->
    
    <!--for Alarm Clock-->
    <receiver android:name="com.gigadrillgames.androidplugin.alarm.AlarmManagerBroadcastReceiver"/>
    <service android:name="com.gigadrillgames.androidplugin.alarm.AlarmService" android:enabled="true" android:exported="true"/>    
    <!--for Alarm Clock-->   
    
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
  </application>
</manifest>

 

so let’s discus each one

Basic Permission – every Android Manifest file should have this i think because there’s a big chance that you will need this along the way on your development.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  
<uses-permission android:name="android.permission.GET_TASKS"/>

Vibrator Permission – most of the people think vibrator will work without permission think again.

<uses-permission android:name="android.permission.VIBRATE"/>

Camera Permission

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.front" android:required="false" />

Flashlight Permission   – very tricky who would think flash light needs camera permission too

<uses-permission android:name="android.permission.FLASHLIGHT"/>       
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />    

Record Audio Permission

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />

GPS permission

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Blue Tooth Permission

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

Alarm Clock permission

<uses-permission android:name='android.permission.WAKE_LOCK'/>

Speech Recognizer

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />

Device Info Permission

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

 

Tip: always test  your Android Manifest File if running perfectly  , before adding permissions to avoid blaming Permissions tag for your error.

and there you go permissions that is used by our Android Ultimate Plugin, I Hope this shed light on you Guys

For more Information

http://www.gigadrillgames.com/android-ultimate-plugin/

For more tutorials

http://www.gigadrillgames.com/2015/07/26/list-of-tutorials-for-android-ultimate-plugin/

For questions or comments or suggestions or any feedback just email us at gigadrillgames@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.