Is Google SDK handle the background location? - android

I am working on ride hailing app. I am getting location in the background after every few seconds. To get location, I am using Foreground Service. It is working fine.
But on some devices, there are different types of options to control the Background power consumption. If these options are enabled then these devices will freeze/terminate may app and foreground service too.
Due to which My app will not update the location.
Is there any solution to get location or not in this case?
For further details. please have a look on this link
FurtherMore, my second question is that if I will use Google SDK for this purpose, will google handle this or not?
If I use google sdk then will google sdk be responsible to get location in each scenario or not?

Related

IOS App auto running in background

I'm developing an IOS / Android gps based application that needs to update location always (or after significant location change). Similar to Life360 family locator app. This app doesn't need to start at all and yet when you open the app it has all your location data captured for a week. If I'm checking on my kids location and they don't have their phone actively running the app, I still get the real-time location and their gps history.
How is this accomplished? It seems that the app is logging gps data, not only when in foreground and background but when not running at all. Is there a special run-mode these apps use?
thanks all!
Mike
I can only speak for iOS.
On iOS you can register for significant location changes, and your app will get notified in the background when a location change event occurs (and even get launched in the background if it had been terminated). You can then request background time and transmit your updated location information to your server.

Google API GPS location Android available to all activities

I am able to get the user location by using Google API and Location services. That location is then saved to an online database. However, how would I go about making the location update every X amount of time (lets say 10 minutes). Also, the Google API and location services is linked specific activity. How would I make the location services available to all activities, meaning that once the user is logged in, no matter what activity the user is in, the location would be updated and saved to my database? Finally, if the phone is in sleep mode or the app is running in the background, would the location still be updated?
Thanks, any suggestions or pointers are appreciated!
It is a duplicate question.
There are many solutions.
I recommend to you read following question.
Example: Communication between Activity and Service using Messaging

How to check if Google Maps is running in the background?

I have Google Maps installed on my phone and it is usually fully stopped, because I don't want it to always run in the background, since I believe that it is draining the phone battery.
My question is regarding the actual status of the Google Maps app or service.
If you check an app's info there is a button "Force stop". I believe that it is only activated (meaning you can click it) when the app is somehow running.
I noticed that the Google Maps app seems to get started in some way from time to time in the background, because the button gets enabled regularly.
However there is no such entry in the "Running" section for the list of apps in the android settings.
Does someone know whether it is running or not if the button is enabled? Is there some way to check this by code? Is it supposed to be a service or an app?
I have tried using the getRunningAppProcesses and getRunningServices methods of the ActivityManager class, but can't find any entry that would correspond to the Google Maps app. So I guess it is hidden from the user?!
This link may answer your question as to what is the proper way of getting the apps running in background. It suggests that using getRunningAppProcesses and getRunningServices methods are unreliable. Instead, you have to track the visibility of your app on your own via Activity.onPause() and Activity.onResume().

Android Geofencing sample app only works if another app is open using GPS

I am working with the Geofence API Sample application I've got it running and seems to work alright. I did make the modifications to it to use BroadcastReceiver instead of the IntentService.
But I will only get the notifications if I have some other app open that is using GPS such as Maps, or GPS Tester app.
If I don't have one of those apps open and I walk into the geofence zone nothing happens. But as soon as I launch one of them I will get the notification within a few seconds.
I ended up creating a service that forces the GPS to stay active by requesting location updates on a relatively quick interval.
While this is admittedly a poor work around for a "real" application. It worked for my purposes. In which I needed to be able to present a working proof of concept to an audience, which impeded my ability to use a geo points which were further spread out.
Even I too had a struggle with getting Geofence notification as soon I entered Geofence or Exit the one.There were always delays in notifications until I found a really nice Location Library called little-fluffy-location-library which serves my purpose.Location updates will be broadcast to your app periodically.
According the Documentation it says that:
The library works by using Froyo's passive location listener (only possible with Android 2.2 and up, hence why it works best with it), which listens to location updates requested by other apps on your phone. The most accurate location is broadcast to your app approximately every 15 minutes. If a location update hasn't been received from another app for an hour, the library forces a location update of its own.
I think you should give a try with this Library and Let me know if it works for you!!

Android - Alarm at location

Theoretic question.
In my app I need to create alarm at location functionality.
So user can pick location, set alarm and any time while She/He
will get closer to location alarm will trigger.
I know that I have to create Service to listen the current
location. It is obvious that I can't use GPS.
Any ideas how to figure it out if device is close to location?
I know that I still have Network location, which probably I will
use, but I afraid of that this will consume to much energy.
If there is any internal android system service which provide such
data? That I can just setup receiver.
Any ideas are welcome ;)
I suggest building on Google Play Services in order to get the product working quickly. Of course if you need to target non-Google phones, then program this manually, but only if you have to.
Play offers Geofencing apis - here are the docs:
Creating and Monitoring Geofences
PROS:
Google is constantly updating the Play sdk to optimise the features.
quick to get it working
battery efficiency
CONS:
it will not work on non-Google API devices, i.e. Kindle Fire
Upshot of all this:
if your app relies on Google Maps at all, then use the Play Geofencing.
I decided to use ProximityAlarm in Service.
Great example from this post:
Android GPS proximity alert not working

Categories

Resources