Home > other >  Why android Ibeacon need bluetooth permission?
Why android Ibeacon need bluetooth permission?

Time:12-10

I am using the android (org.altbeacon:android-beacon-library:2.19.3) library providing APIs to interact with Beacons

It has required Location & Bluetooth permission.

Permission Requirements:

https://altbeacon.github.io/android-beacon-library/requesting_permission.html

IOS's ibeacon does not require Bluetooth permission, why does android ibeacon need Bluetooth permission?

is there any alternate library for android Ibeacon

CodePudding user response:

The working logic of the Android side and the working logic of the ios side are different. On the Android side, we need to get a permission for every action related to the user. This is among google policies. There are different libraries developed for the location, but you need to add permissions in the same way. For example, another package you can use for location: https://github.com/mrmans0n/smart-location-lib or all : https://android-arsenal.com/tag/55

CodePudding user response:

Yes, Android requires Bluetooth permission to scan for bluetooth beacons but iOS does not require the same permission to detect iBeacon. The requirement for Android to have Bluetooth permission to scan for beacons is true regardless of the library you use. It is an OS platform restriction.

There reason why Android requires this permission and iOS does not is based on history of how the two platforms evolved. A few points:

  • Starting with iOS 7, Bluetooth beacons support was added to the CoreLocation API, which used on the the Location permission, not individual permissions for various sensors like GPS, WiFi, cellular radio, and Bluetooth, all of which can be used for location purposes. Apple clearly made a design decision to put all of the sensors behind a single permission.

  • Open Source Android has no built-in APIs for detecting beacons at all -- it only has Bluetooth APIs. (Beacon APIs are offered by the Google Play Services add on or the open source Android Beacon Library). So it makes sense that when Bluetooth LE scanning was added in Android 4.3, it was treated as something that must be behind the Bluetooth permission.

  • When Android added runtime permissions in Android 6, it tried to protect the privacy of users by making the Location permission a runtime permission, and further, it put bluetooth scanning behind this same location permission in addition to the Bluetooth permission.

  • On iOS, the Bluetooth LE APIs do require Bluetooth permission, but Apple sandboxed the Bluetooth functionality from iBeacon. In this way, detecting iBeacon must obtain Location permission but does not require Bluetooth permission. On the other side of the coin, non-iBeacon detection is possible with regular Bluetooth permission but Apple filters out any packets that match iBeacon.

One important thing to note: Apple not needing Bluetooth permission to detect beacons only applies to the iBeacon format. If you try to detect AltBeacon or Eddystone you actually do need the Bluetooth permission (and not the Location permission for those formats.) This is a "loophole" that is useful for avoiding extra permissions in some cases on iOS devices.

  • Related