I'm risking a few down-votes with this question, but today I've received a flood of user emails saying that every time my application starts, the GPS icon appears briefly in the notification bar - and I can replicate.
Pulling down the notification shade, I see 'Searching for GPS' momentarily appear - Managing to long-click it and select App-Info, it leads me to the System UI Application Settings.
In the logcat I see:
D/LocationManagerService(2358): request 448e9c20 gps Request[ACCURACY_FINE gps requested=+60m0s0ms fastest=+60m0s0ms] from com.google.android.gms(10021)
D/LocationManagerService(2358): provider request: gps ProviderRequest[ON interval=+60m0s0ms]
D/GpsLocationProvider(2358): setRequest ProviderRequest[ON interval=+60m0s0ms]
D/GpsLocationProvider(2358): startNavigating, singleShot is false
D/GpsLocationProvider_ex(2358): getSKAFEnable : false
D/GpsLocationProvider(2358): setting position_mode to MS_BASED
So, are any other developers having reports of this, the cause of which I assume is an update to Google Play Services?
I've changed nothing in my code (reports are coming in from users running a version 9 months old), so posting code that hasn't changed, seems a little pointless....
I thank you in advance....
EDIT - This seems to be something to do with using the Speech Recognition API as it is occurring in the Google Now application, every time you press the mic icon.
Related
I would like to ask a clarification about the meaning of the "Searching gps" notification. I have a simple app that tries to retrieve user position via FusedLocationProviderClient with this code:
val fusedLocationClient = LocationServices.getFusedLocationProviderClient(activity as Activity)
fusedLocationClient.lastLocation
.addOnSuccessListener { location: Location? ->
mMap.isMyLocationEnabled = true
// other trivial stuff here
}.addOnFailureListener {
// showing an error here
}
Even when last location is retrieved android keeps showing the "Searching gps" notification (Ricerca gps in the screenshot below). As far as you know, this means that app is still searching for gps updates (and so draining battery) or is a simple message to notify the user that the app is using the gps? Thanks for the clarification, my device is a Xiaomi Redmi 5 Plus (MiUI)
I'm not 100% sure I understand the question, but I'll take a stab here. I think one of two things is going on:
The notification is being explicitly shown by the MyFoody app and it's that app's responsibility to hide the notification once it no longer needs to be shown. You'd need to take care of clearing that notification in the listener's success and failure functions you've defined. Are your listeners being called? Do they clear the notification?
OR
It may be that Xiaomi has modified Android to show that notification on behalf of your app while it's retrieving location(s). If that's the case, then you'd need to figure out why this Xiaomi-modified Android version still thinks your app is trying to get a location. It could also just be a bug on Xiaomi's part, but I'd consider that as a last resort.
I have a popular read aloud app, that is also often used by visually impaired and blind people. Some, very few of them complain that when using the app or having it read aloud, it repeatedly says "Service at Voice" (my app's name is #Voice Aloud Reader). I tested this on several phones with different versions of Android and TalkBack enabled, but couldn't reproduce this problem.
The app is showing a notification with reading progress and buttons to pause/resume, FF and reverse etc. Of course all the reading aloud is done from a service, not activity, because a user may want to close my activity, or even turn off screen, and still listen. I would gladly post more technical details, but don't know which ones are relevant.
I tried searching for any combination of terms "TalkBack saying 'service' repeatedly", but cannot find anything relevant. My users who contacted me about this could not find either any setting in TalkBack app to make it stop saying this. Could anyone shed some light on this issue?
I found the reason for my problem, part of it was my own app code, and part just confusing behavior of Android system and TalkBack on different devices. Here is what was happening:
The app, #Voice Aloud Reader, reads text loaded into it (web pages, docs, books) and highlights the sentence it reads aloud. On each change of sentence it updates progress, both on its own screen if visible, and in the notification. The notification update code is pretty old, from Android 4 days. I did not know then how to update the content of notification, it seemed to me that the only way to update it, after using NotificationBuilder to update content, was to call in my service again:
startForeground(/* id: */ 1000, myNotifBuilder.build());
It worked well for years, also under TalkBack, no problems. Even today on at least 5 test devices I have with Android 5 to 9 and with emulators, TalkBack activated, it works correctly. But some users reported that upon reading each new sentence (progress update), TalkBack says "Service #Voice". I finally updated the code as follows, and my users report that the problem is solved:
if (newNotification) {
startForeground(/* id: */ 1000, myNotifBuilder.build());
}
else {
NotificationManagerCompat.from(this).notify(1000, myNotifBuilder.build());
}
I doubt that this knowledge will help many people, now notifications are documented better and there is a clear "Update notification" chapter that explains how to do this correctly in Google documents for developers.
I bet it's announcing the app name on orientation changes each time the MainActivity is created.
SO link
So I have an app that works flawlessly on many devices. The problem is on one specific phone with Android 6.
The location for our app only works when another app uses the GPS.
For example, starting our app, the GPS icon starts as if the GPS was active but location updates on the app do not appear or refresh. Then, we start Google Maps and only then locations on our app start getting refreshed. As soon as we close Google Maps, our locations stop being received.
I actually tested the app on another phone with Android 6 with no problems.
I think there might be some kind of issue with Google Play Services or with the new the permissions schema. Or maybe with BroadcastReceiver receiving the position updates.
Key information:
Our app es compiled for SDK 22 with Google API.
Google Play Services version on the phone with the issue is 8.4.92
The app uses this version of play services:
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-location:7.+'
compile 'com.google.android.gms:play-services-maps:7.+'
compile 'com.google.android.gms:play-services-gcm:7.+'
All permissions are activated for our app on that phone.
The phone with the problem was working fine before it got updated to Android 6.0
We tested on another device with Android 6.0 and had no issues.
The phone is in a client in another continent so we don't have access to debugging or logs. No errors occur though because we would receive those on Fabric.io.
We use a Broadcast to dispatch new positions to a service and an activity so the problem might be there.
Im running out of options and tests.
Any ideas?
Thanks,
EDIT
The problem is that on that version of Android, getSpeed from Location is always 0.0, unless another app is using the location, then we get updates with the speed included.
This really sounds like a bug. Why would legacy apps not get the speed in the location? Assuming its because we use API 22.
On a side note, we use speed to filter out positions and stop updating location when the phone is standing still. Thats why we did not see location updates.
I guess we will have to calculate our own speed.
We have a weather app for Android that also provides a widget.
The widget displays the current time and weather for the current user location.
We update the widget clock every minute (via AlarmManager) if the display is active, the weather data at longer intervals. Sometimes the widget "freezes". We were able to track that down to the alarm for the next check not being set but don't have a clue why, yet.
Now we noticed the following warning in the device logs of an affected device:
03-12 10:15:44.803 771 4958 W ActivityManager: Permission Denial: opening provider com.google.android.gsf.gservices.GservicesProvider from ProcessRecord{41a4d028 25012:com.my.app/u0a88} (pid=25012, uid=10088) requires com.google.android.providers.gsf.permission.READ_GSERVICES or com.google.android.providers.gsf.permission.WRITE_GSERVICES
This starts to appear exactly at the time where the clock should have been updated. The message is then repeated several times until the ActivityManager terminates the process.
We use the Google Play Location Services to get the current (or last known) location of the user. I found references to a bug in version 4.2 of the services (here and https://stackoverflow.com/questions/22682538/when-to-use-read-gservices-permission) that could cause this error, but the device has version 6.7.76 installed.
One more thing to consider is that the device is running Cyanogenmod, though the stuck widget problem also happens on devices with "regular" Android.
Any hints what could cause this permission error are very much appreciated. Thanks!
Edit: The widget and app work fine on that and many other devices until the warning appears. Also the Google documentation is not mentioning that you need to get those permissions. In fact the only mention of those is here in this document according to the on site search, but no mention of READ_GSERVICES on the page itself.
The two permissions it is asking for:
<uses-permission android:name="com.google.android.providers.gsf.permisson.READ_GSERVICES"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.WRITE_GSERVICES"/>
Something to remember just because this issue was reported in Google Play Location Services in 4.2 does not mean it has been fixed. It may be worth looking through the Google bug reported to see if anyone has any issues. I found a few issues raised running much newer Google Play Services.
Upon doing a quick Google search myself it seems like the major problem phones are the Moto X and the Nexus 5. Which is rather interesting as they are both Android Open Source Project bugs (i.e phones running stock Android with no skin!)
Just a few questions:
Can you confirm what phone you have and which version of Android you
are running please?
Also what is your target SDK?
What version of play services are included in your APK?
I downloaded the GeoDetection.zip file for trying out location based geofencing using the Google Play Services API that is available from the developer android website from the following link:
http://developer.android.com/training/location/geofencing.html
but when i tried to add geo fences using this app, i constantly get the error GEOFENCE_NOT_AVAILABLE
i tried to check what this error means, and i found that if location access is not available that is when i should get this message, but i checked the Location Services section on my phone and i saw that all the Location provides GPS/Wifi Location are all enabled. I am also connected to WIFI successfully. Not sure why i still get the message.
Any body else encounter this issue?..if so, do you have a fix that i could try?
Any other suggestions?.. i tried a lot of options to make sure it is capturing all the options, but there is isn't much debug information for me to proceed any further.
Thanks in advance
Are you requesting the FINE_LOCATION permission?
Remember on Android 6 and above you have to handle the permissions at run-time too.
The above error, GEOFENCE_NOT_AVAILABLE is an expected error code, to let you know that the location adapter is off and location (and geofence) will NOT be tracked anymore.
Once available again, your geofences will be active and you will get the desired callback.
Few Reasons why the triggers aren't happening :
Check if your expiry timestamp that you set in your geofence request, is still valid.
Did your device get restarted ? If yes, you need to re-register fences. (Refer documentation : Re-register geofences only when required documentation)
Is your location, set to High Accuracy mode in Device settings ?
When you re-register your fences, you should un-register them first and then only re-register.
Open Google maps and check if it's showing the right location.
Is Battery Optimisation on for your device ? This will delay geofence triggers
Is you app whitelisted for background operations (Happens in some Chinese OEM's)