1

I've made an app that gets location from either GPS, Network, or Passive and picks the best provider based on the accuracy and time. The app works well on my phone, running Android 2.2, but on a friend's phone, running 4.2, he is not able to get a location indoors (from a passive provider). I'm a bit cynical and think that Google just wants me to sign up for Google Maps Geolocation API so I can pay for the passive provider after 1000k requests. Is there a way I can fix the app for 4.2 or do I need to sign up for the API?

Info: In the google maps app, he gets a virtually perfect location.

This function can give me a very good location on my phone, but no location on my friend's phone:

if (lastLocation_passive != null) {
            time_passivefix = (System.currentTimeMillis() - lastLocation_passive
                    .getTime()) / (1000 * 3600);
            accuracy_passivefix = lastLocation_passive.getAccuracy();
            Log.i(TAG, "Time and accuracy from last passive fix is: "
                    + time_passivefix + " " + accuracy_passivefix);
            accuracy_passivefix = lastLocation_passive.getAccuracy();
            Log.i(TAG,
                    "Passive fix got fix from: "
                            + lastLocation_passive.getProvider());
            if (time_passivefix < 1 && accuracy_passivefix <= 150)
                return lastLocation_passive;

EDIT: Is that Google down-voting my question?

Stagleton
  • 1,060
  • 3
  • 11
  • 35
  • Getting a location indoors is hit or miss. And if you get a fix in the same spot your friend can't, it's more than likely a difference in the GPS hardware of your respective devices. – 323go Oct 17 '13 at 03:52
  • Have a look at the new [Location API](https://developer.android.com/google/play-services/location.html) that was introduced earlier this year, as part of the Google Play Services. In particular, consider using the Fused Location Provider - that's also what Google Maps uses. And yes, it's free, and last time I checked there are no hard quotas. – MH. Oct 17 '13 at 03:52
  • @323go he's able to get a perfect location through the googlemaps app. That must be a software/provider difference. I'm sure the hardware on his phone is better than mine – Stagleton Oct 17 '13 at 04:06
  • @MH I will take a look and do a bit more reading. thanks – Stagleton Oct 17 '13 at 04:09
  • 1
    Upvoted your question. Its a tough problem to solve, since android API's dont give location easily. Search on SO, you will get many answers for this. If the answers work for you, dont forget to upvote them. – taxeeta Oct 17 '13 at 04:25
  • http://stackoverflow.com/questions/17108821/getting-null-on-current-location-on-samsung-galaxy-grand-android/19355260#19355260 – taxeeta Oct 17 '13 at 04:26
  • http://stackoverflow.com/questions/17761390/location-is-not-getting-in-samsung-phone-if-gps-is-disabled/19355235#19355235 – taxeeta Oct 17 '13 at 04:27
  • http://stackoverflow.com/questions/16830047/locationclient-getlastlocation-return-null/16868879#16868879 – taxeeta Oct 17 '13 at 04:27
  • @taxeeta, why would you upvote a question that you yourself say has many helpful answers on stackoverflow already? Shouldn't that be a duplicate flag instead? – 323go Oct 17 '13 at 14:11
  • @323go ahh, was it not google that dv'ed the question?? anyway, I still have not found the reason with the answers. I have a tablet running 4.2 and it gives me a near perfect location from the passive provider. I'm very sure it's not hardware. – Stagleton Oct 17 '13 at 17:56
  • I'm pretty sure google has much better things to do than downvote questions on stackoverflow, just because they contain silly conspiracy theories. Your last comment contradicted that anyway... you have a tablet with "near perfect location" on 4.2, but your friend's phone (also 4.2) does not. Same OS, different hardware. Which do you think is the culprit? – 323go Oct 17 '13 at 21:01
  • betting on the software still. Im fairly certain google downvoted my question....or you :) – Stagleton Oct 18 '13 at 17:52

0 Answers0