Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android权限:需要蓝牙权限的应用程序崩溃_Android_Bluetooth_Android Bluetooth - Fatal编程技术网

Android权限:需要蓝牙权限的应用程序崩溃

Android权限:需要蓝牙权限的应用程序崩溃,android,bluetooth,android-bluetooth,Android,Bluetooth,Android Bluetooth,我最近正在创建一个使用蓝牙的应用程序。问题是,每当我启动蓝牙服务时,我的应用程序就会崩溃。这是我的清单文件 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="in.petalappstudio.fit" > <uses-permission android:name="ANDROID

我最近正在创建一个使用蓝牙的应用程序。问题是,每当我启动蓝牙服务时,我的应用程序就会崩溃。这是我的清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.petalappstudio.fit" >

<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH"/>
<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH_ADMIN"/>

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <service
        android:name=".bluetoothManager"
        android:enabled="true"
        android:exported="true">
    </service>
</application>

但正如你所看到的,我已经添加了权限。现在,为什么会发生这种情况?

尝试再添加一个权限:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

参考文献:

注意:还要检查设备是否支持蓝牙功能或不使用:

<uses-feature android:name="android.hardware.bluetooth" android:required="true" />


谢谢,我没这么想。:)是的,我看到了,也加了一句。这是有帮助的,谢谢:)好的,很高兴能帮助你,如果是帮助你解决你的问题。
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />