Wednesday, January 9, 2013

Re: [android-developers] Re: location updates using network provider

FYI 90 seconds would not really be a good fit for an AlarmManager,
it's not meant to be used with that kind of granularity.

Instead, if you absolutely need it you should instead request a finer
interval. At 90 seconds, your app will probably be a sort of battery
hog anyway..

Kris

On Wed, Jan 9, 2013 at 2:51 PM, Nobu Games <dev.nobu.games@gmail.com> wrote:
> As far as I know Android tries to calculate an update plan among all
> location requesting apps. It comes up with an update strategy according to
> all these request parameters and therefore these values you specify can just
> be seen as your best case scenario "wishes". You cannot take them for
> granted since a lot of factors can be responsible for inaccurate results.
>
> The documentation of requestLocationUpdates states that it can take longer
> than your minimum update interval time to receive an update. However, it
> also states that the location update time will never be less than your
> minimum update time. Your observed 75 seconds seems to contradict the
> documentation. It may be a bug in Android.
>
> If you need to have your app "alive" every 90 seconds in order to phone home
> or something like that you probably need to make use of the AlarmManager
> component on top of these location updates. Be aware that stuff like that
> can be a burden on the battery life and users won't appreciate that.
>
> Read the following for more information:
>
> http://developer.android.com/guide/topics/location/strategies.html
> Excellent PDF about location update strategies:
> http://www.deutsche-telekom-laboratories.com/~kyuhan/papers/MobiSys10Kim.pdf
>
>
>
> On Wednesday, January 9, 2013 6:29:40 AM UTC-6, Narendra Singh Rathore
> wrote:
>>
>> Hello all,
>>
>> my requirement is to get location updates every 90 seconds. I am using
>> network provider for this.
>>
>> I am doing this as given below:
>>
>> locationManager.requestLocationUpdates(
>> LocationManager.NETWORK_PROVIDER,
>> MINIMUM_TIME_BETWEEN_UPDATES,
>> MINIMUM_DISTANCE_CHANGE_FOR_UPDATES,
>> new MyLocationListener()
>> );
>>
>> Here, in this method, I am passing 90000 as MINIMUM_TIME_BETWEEN_UPDATES,
>> and 0 as MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, so the expected result should
>> be:
>>
>> The method onLocationChanged should be called every 90 seconds.
>>
>> But, the outcome is: the onLocationChanged method is being called first in
>> 75 seconds, then in 105 seconds, then 75, 105.....and so on..
>>
>> But my requirement is to get the location updates in 90 seconds instead of
>> different durations/periods.
>>
>> In case, if location returns null, I want to get the last known location.
>>
>> Please, suggest me the way to resolve this problem.
>>
>>
>> Thanks & Regards,
>>
>> NSR
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate