bhsu
bhsu

Reputation: 402

Android Development: How to request permissions?

I was just wondering how to request permissions when creating an android application. I am a beginner, so please explain in simple terms :D.

So I want to make it so that my app can vibrate the phone at certain times, and the permission is called "android.permission.VIBRATE." But how do I request this? I do it in the Android Manifest file right?

Thanks for all help!

Upvotes: 0

Views: 359

Answers (1)

Rev Tyler
Rev Tyler

Reputation: 603

You're definately right. You need to put it in the AndroidManifest.XML

If you're using eclipse you can do it quite easily and without XML by opening up AndroidManifext.xml and use the Permissions tab at the bottom and press the "Add" button and selecting "Uses Permission" Then just select vibrate from the dropdown list.

If you want to do it in XML code you can add it before the application tag, like so:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:name="Application" > 

(the rest of your manifest continues from here)

Upvotes: 1

Related Questions