As I got notification from google about the ACCESS_FINE_LOCATION permissions. As I understand if we don't add "android.hardware.location.gps" uses-feature to your manifest it will visible to non GPS hardware device also.
If I add that my application wont display to them and I don't want to do that.
I want to check that how app is reacting on device that not having GPS Hardware. How can I create simulator for this?
Actual message from Google Play Store
Action required: If your app requires GPS hardware to operate properly, you will need to explicitly add the "android.hardware.location.gps" uses-feature to your manifest.
What’s changing
We’re making a change on October 15th, 2016 that will affect apps targeting API version 21 (Android 5.0, Lollipop) or higher that use ACCESS_FINE_LOCATION but don't explicitly have the "android.hardware.location.gps" uses-feature. Going forward, these apps will be available to install on devices that don't have GPS hardware. In most cases this won't be an issue since Wi-Fi and Cell-ID based location provides high enough fidelity for the typical operation of these apps. However, any apps that require GPS hardware, such as GPS navigators, should explicitly add the "android.hardware.location.gps" uses-feature to their manifest.
If your app requires GPS to function properly and you do not include android.hardware.location.gps in your manifest declaration, your users may have a poor app experience.
Read More about this change here
You can try this on the real device. For example, Lenovo A369i doesn't have GPS Hardware. If you don't have real device without GPS you can create corresponding virtual device. Go to Android Virtual Device Manager -> Create Virtual Device -> New Hardware Profile. There you can find GPS checkbox, so you should switch off it and you will create device without GPS.
Related
I am building an Android app that scans two types of beacon each second using the android-beacon-library:
iBeacon type
custom beacon type
I am using the library since the 2.10 release and everything works fine.
But, when I try to implement the 2.16.2, 2.16.3 and 2.16.4 releases on my Samsung S8 (which is running on Android 9), I can't scan my Beacons when I turn off the location. I did not have this issue with the 2.16.1 release.
I also tried the reference app to check if I did something wrong, but I have the same bug with the reference app.
I may specify that I only have this issue with Samsung.
Thanks.
Recent versions of Android require multiple levels of location authorization for an app to detect beacons (bolded items show added requirements):
SDK 29+ (Android 10.0+)
Bluetooth must be turned on in settings
Location must be turned on in settings
Apps must have FINE_LOCATION permission in the manifest (COARSE_LOCATION is no longer sufficient)
Apps must ACCESS_BACKGROUND_LOCATION in the manifest to detect beacons when the app is not in the foreground with the screen on.
Apps must have dynamically obtained FINE_LOCATION permission from the user
Apps must have BLUETOOTH and BLUETOOTH_ADMIN permission in the manifest
SDK 23-28 (Android 6.0-9.x)
Bluetooth must be turned on in settings
Location must be turned on in settings
Apps must have COARSE_LOCATION permission or FINE_LOCATION permission in the manifest
Apps must have BLUETOOTH and BLUETOOTH_ADMIN permission in the manifest
Apps must have dynamically obtained COARSE_LOCATION permission or FINE_LOCATION permission from the user
SDK 18-22 (Android 4.3-Android 5.x)
Bluetooth must be turned on in settings
Apps must have COARSE_LOCATION permission or FINE_LOCATION permission in the manifest
Apps must have BLUETOOTH and BLUETOOTH_ADMIN permission in the manifest
The above restrictions have nothing specific to do with the Android Beacon Library -- they are an operating system requirement for any Bluetooth LE detection. If you see that some devices to not enforce these requirements under some conditions, then that is most likely an implementation hole on that specific platform. The more general rules still apply.
I have noticed in Android 6.0 that if you try to disable the permission for PHONE on the stock Phone app, the Settings app informs you that you are disabling a critical function. If this is disabled, "the basic features of your device may no longer function as intended". But, If you try to disable the permission for LOCATION on the phone app, the Settings app does nothing. What is the mechanism that the phone app uses to distinguish a critical function from a non-critical function?
I am asking a follow up question to my previously asked question -> http://stackoverflow.com/questions/33607410/background-monitoring-of-eddystone-beacon-using-altbeacon-library-on-android-pla/33613116?noredirect=1#comment55139316_33613116.
Where i was able to successfully detect beacons both in the foreground and background until I found out that the same code was unable to detect the beacon when i try to run it on nexus 5 device running android 6.0.
Can anyone provide a explanation to why this is happening? Thanks.
Android 6.0 imposes two new requirements in order for apps to detect BLE Beacons:
Location Services must be turned on in settings. Settings -> Location -> On. The specific mode may be either "High Accuracy" or "Device Saving". This is a new requirement that appears to be being rolled out to all firmware builds from Google. Without this on, BLE scans discover no devices.
The app must be given runtime permissions by the user to ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION. You must code your app to present one of these permission requests to the user. If not granted, the app will not be able to detect BLE Beacons.
A detailed explanation of this process is in my blog post here: Is Your Beacon App Ready For Android 6.0?
With Android 6.0, you now need to request location permissions at runtime in order to be able to discover beacons.
From our initial tests: if your app targets SDK < 23 (i.e., pre-Android 6.0), you will only need these permissions to detect beacons in the background. If your app targets SDK >= 23 (i.e., Android 6.0 or later), you will need these permissions to detect beacons both in the background and in the foreground. You also need to have Location enabled on your Android 6.0 device for both cases.
Google has a detailed guide on how to implement checking for and requesting runtime permissions:
http://developer.android.com/training/permissions/requesting.html
Specifically, you need either ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION. They both actually display the same message ("Allow APP_NAME to access your location?") to the user.
I developed an app that work with iBeacons and this week i update it to work on Marshmallow. Until the update it didn't require GPS, but after the update it says that to find beacons in background it need gps. i don't find any reference on it. does someone know why Android Marshmallow requires GPS to find iBeacons?
I use altBeacon library to locate the beacons.
edit:
I'll clarify the question. Is the GPS involved in finding Beacons. Except for the permissions.
No, it is not necessary to have GPS turned on or even have a device with a GPS radio to detect beacons in Android 6. The GPS radio, if present is not activated when scanning for Bluetooth beacons.
The confusion comes from the fact that Android 6 newly requires apps to obtain either ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions to be allowed to perform bluetooth scans. This change is simply motivated by informing users that bluetooth scanning can be used to infer their location (like with beacons). But the need to get this permission does not mean there is any technical dependency on the GPS radio. Consider that Android also can use WiFi access points and cell towers to infer location.
On some devices, notably the Nexus 5, there have been reports that disabling Location Services (Settings -> Location -> Off) disables the ability to scan for bluetooth devices. It is unclear whether this is a bug in that Nexus 5 build image or a new security restriction by Android that will be followed on other models in the future. See here for more info. Regardless, having the GPS radio on is not a requirement for Location Services being enabled.
Full disclosure: I am the lead developer on the Android Beacon Library open source project.
from http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html
To access the hardware identifiers of nearby external devices via
Bluetooth and Wi-Fi scans, your app must now have the
ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions:
It's not GPS as such that it needs, but because beacons are a technology that can also pin point your location, the location permission is required.
This is probably a permissions issue. iBeacon uses BT Low Energy, and in Android 6, you need location permission to initiate a scan:
To access the hardware identifiers of nearby external devices via Bluetooth and Wi-Fi scans, your app must now have the ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions
Source: Android 6.0 changes
I'm in the middle of building a Wear App for an existing phone app.
We plan on targeting API 23 and modifying our phone app's location permissions to work with Android new runtime permission model (https://developer.android.com/training/permissions/index.html)
I was trying to figure out how the Wearable device running Android 5.0 is going to work once we do that. From what I've learnt when asking for locations for the Wearable from https://developer.android.com/training/articles/wear-location-detection.html:
The wearable may or may not have a GPS radio present. For wearables that do not have a radio, the location data comes from the tethered device.
We don’t need to worry about the source of location data – FusedLocationProvider (as part of the Google Play Service) handles this for you behind the scene.
We are responsible for handling the edge case where the wearable does not have GPS hardware (can be checked via hasSystemFeature()) and if the tethering is interrupted (can be detected via WearableListenerService). An example of this would be when the user goes for a run without the phone. In this case, we are expected to degrade the functionality gracefully.
What’s puzzling me is how this will work when we migrate to the new Marshmallow permission model.
Android Wear is not affected if the hardware has on board GPS since no wear devices run Android 6.0 and the old permission model applies. The problem would come about if a wear device with no GPS hardware is tethered to a device running Android 6.0. In this case, if the wear device requests for the location, it would passed on to the phone and the user has not been asked permission/or has disabled the permission, how will this work at all?
I'm imagining that need to hack around this:
On wearable app start, first check if the hardware has a GPS radio
If no, send a message to the phone to ask if holds the permission for requesting location (use the data sync APIs for this)
If the answer comes back false, then show a message to the user on the wearable and ask if they want to resolve it on the phone.
If the user answers “yes”, push a message to the phone to show an activity where it would just prompt for permission.
Is there a better way to do this?