Android Permission BLUETOOTH Manifest error

前端 未结 2 1825
时光取名叫无心
时光取名叫无心 2021-01-25 14:55

Following is the AndroidManifest.xml for a Simple Bluetooth pairing Android Project




        
相关标签:
2条回答
  • 2021-01-25 15:17

    The maxSdkVersion attribute version is for telling the highest API level at which this permission should be granted to your app. Setting this attribute is useful if the permission your app requires is no longer needed beginning at a certain API level.

    For example, beginning with Android 4.4 (API level 19), it's no longer necessary for your app to request the WRITE_EXTERNAL_STORAGE permission when your app wants to write to its own application-specific directories on external storage (the directories provided by getExternalFilesDir()). However, the permission is required for API level 18 and lower. So you can declare that this permission is needed only up to API level 18 with a declaration such as this:

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

    This way, beginning with API level 19, the system will no longer grant your app the WRITE_EXTERNAL_STORAGE permission.

    So the error was that even lollipop needs you to ask permission for accessing bluetooth.

    0 讨论(0)
  • 2021-01-25 15:28

    Looks like it was a pretty straightforward solution. I was testing on Android Lollipop ( > maxSdkVersion ) hence the error.

    0 讨论(0)
提交回复
热议问题