I have a simple app that so far just turns bluetooth on/off, when i run it on emulator or on a nexus 7 it says my app has stopped responding and then closes itself upon launch. I tried adding an onStart() method since that fixed this issue in a similar question, adding the intent that gets users permission and switching around various things to different methods, still crashing however.
Logcat has these messages:
07-29 01:05:41.541: E/AndroidRuntime(9745): FATAL EXCEPTION: main
07-29 01:05:41.541: E/AndroidRuntime(9745): java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackagename/mmypackagename.MainActivity}: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10067 nor current process has android.permission.BLUETOOTH.
Here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mypackagename"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BlUETOOTH"/>
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="16" />
<application
android:icon="@drawable/homeiconsmall"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You misspelled the permission in your manifest (BlUE
!= BLUE
):
<uses-permission android:name="android.permission.BlUETOOTH"/>