views:

180

answers:

2

I'm new to Android development. I'm trying to get a simple HelloWorld app going on my (rooted) phone - and the app is trying to enable Bluetooth.

I've set the Bluetooth permissions in my manifest is as follows, but I'm getting a Permission Denial exception when I try to run the application on my phone via Eclipse:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.helloandroid"
          android:versionCode="1"
          android:versionName="1.0">      
        <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true" android:permission="android.permission.BLUETOOTH_ADMIN">
            <activity android:name=".HelloAndroid"
                      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>


<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-sdk android:targetSdkVersion="7" android:minSdkVersion="5"></uses-sdk>
</manifest>

Is there something obvious I'm missing?

+1  A: 

The element types in the manifest are ordered. I think the uses-permission needs to be first under the tag.

Mayra
Thanks for the quick response Mayra. I've tried moving the uses-permission tag around in the file and it doesn't seem to fix the problem - and the example manifest files I've seen often seem to include the uses-permission tags at the bottom of the file - so I don't think that the location of the tag is critical.
Jon Mills
Ok, I think you are right. I had a problem with permissions before that I thought was solved by order, but I see other places in the documentation where things are out of order. What is the exact error message that you are seeing?
Mayra
A: 

I'm not quite sure what the problem was here.

All I can say is that I reinstalled Eclipse and it's plugins and now everything is working fine. Thanks for your help Mayra - I'll up-mark your answer because of your helpful and friendly approach.

Jon Mills

related questions