Android的Bluetooth_admin权限错误 [英] Android Bluetooth_admin permission error
问题描述
关于Android的蓝牙发现。
Regarding Android bluetooth discovery.
获取此错误清单权限错误。然而,我发现张贴的唯一错误,是他们忘了许可应用程序之外。然而,这不是这里的情况。
Getting this error from manifest permission error. However, the only errors that I found posted, was that they forgot to put the permission outside the application. This is however not the case here.
该程序在银河S2测试运行果冻豆4.1。
The program is tested on a Galaxy S2 running Jelly Bean 4.1.
的错误是如下:
03-19 13:08:03.933: W/dalvikvm(12616): threadid=1: thread exiting with uncaught exception (group=0x413082a0)
03-19 13:08:03.938: E/AndroidRuntime(12616): FATAL EXCEPTION: main
03-19 13:08:03.938: E/AndroidRuntime(12616): java.lang.SecurityException: Need BLUETOOTH_ADMIN permission: Neither user 10004 nor current process has android.permission.BLUETOOTH_ADMIN.
基本上清单如下:
Basically the manifest looks like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.motioncontrol"
android:versionCode="1"
android:versionName="1.0" >
<user-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:debuggable="true"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.motioncontrol.Main"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".AccelerometerDat"
android:label="@string/accelerator_title" />
<activity
android:name=".GyroscopeData" />
<activity
android:name=".Gravitydat" />
<activity
android:name=".Linearacc" />
<activity
android:name=".Bluetooth" />
<activity
android:name=".CheckBluetooth" />
<activity
android:name=".About"
android:label="@string/about_title"
android:theme="@android:style/Theme.Dialog" />
</application>
</manifest>
和发生错误的类:
private void doDiscovery() {
if (D) Log.d(TAG, "doDiscovery()");
// Indicate scanning in the title
setProgressBarIndeterminateVisibility(true);
setTitle(R.string.scanning);
Log.d(TAG, "indicates scanning");
// Turn on sub-title for new devices
findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);
Log.d(TAG, "Set up sub-title for new devices");
// If we're already discovering, stop it
if (mBtAdapter.isDiscovering()) {
mBtAdapter.cancelDiscovery();
Log.i(TAG, "Already running discovering, stop it!");
}
// Request discover from BluetoothAdapter
mBtAdapter.startDiscovery();
Log.d(TAG, "Request discover form BluetoothAdapter");
}
希望的答案,什么错误。)
Hope for an answer, what is going wrong :).
谢谢!
推荐答案
修改
<user-permission android:name="android.permission.BLUETOOTH_ADMIN" />
到
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
&lt;使用者许可权&GT;
用来调节其他应用程序的访问给当前的组件。你应该尝试&LT;使用许可权&GT;
来获得特权。
<user-permission>
is used to regulate the access to the current component by other application. You should try <uses-permission>
to get the privilege.
这篇关于Android的Bluetooth_admin权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!