- Home /
Android Plugin and permissions
Hi!
I'm in the middle of creating a plugin to enable my unity project to use gps location, much like it is possible on the iPhone.
I know that I would need to set permissions to use location info, namely android.permission.ACCESS_COARSE_LOCATION and android.permission.ACCESS_FINE_LOCATION
But I don't know where I would set them? Do I have to overwrite the AndroidManifest? Is there a "clean" AndroidManifest.xml like it is generated by Unity? Or can I simply extend the generated one?
Thanks in advance!
Answer by Morothar · Dec 19, 2010 at 06:15 PM
I found the answer:
The default AndroidManifest.xml is found in "Unity3\Editor\Data\PlaybackEngines\androidplayer"
I copied it to my android plugin folder and extended it with my needed permissions. Worked without any problems!
Answer by nestheking · Jul 27, 2015 at 05:00 PM
It can be as follows:
<?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:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:theme="@android:style/Theme.NoTitleBar"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:debuggable="true">
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
</manifest>