@TreKing: getBestProvider(); returns GPS but as my app is perfectly
functional without the GPS I would like to use the cell network even when
GPS is available. Is there any way to do so?

Thanks

On Thu, Jul 7, 2011 at 7:13 PM, Raghav Sood <raghavs...@gmail.com> wrote:

> I am aware of the last know location returning null. As for my code using
> GPS, the book that I learnt geo services said that this shouldn't happen.
> Seems they were wrong.
>
> Coming back to the point. Is there any way to make sure that the app does
> not use GPS? That is even if GPS is on the app only uses the cell network?
> The whole point of my app was to provide the location without the GPS being
> used. Can I set the provider of the location?
>
> Thanks
>
>
> On Thu, Jul 7, 2011 at 7:06 PM, Mark Murphy <mmur...@commonsware.com>wrote:
>
>> On Thu, Jul 7, 2011 at 9:28 AM, Raghav Sood <raghavs...@gmail.com> wrote:
>> > I have a app that triangulates the users location and displays it on a
>> map
>> > without using the GPS. As long as the GPS is off the app does its job
>> > perfectly. The moment someone turns the GPS on the app force closes and
>> > gives a NullPointerException on line 37 of MyPositionOverlay which is
>> given
>> > above. If needed I am willing to share the source code for the entire
>> > project as there is nothing special in it. It is attached with this
>> mail.
>> > I would like this group's help on the fact as to why the app force
>> closes
>> > when the GPS is turned on and how do I fix it. The app does not use the
>> GPS
>> > at all.
>>
>> First, your overlay's location data member will be null sometimes, the
>> way this is written. getLastKnownLocation() can return null at any
>> time, and in that case, you don't have a Location to work with. You
>> will need to either add intelligence to the overlay to handle this
>> case, or not set up the overlay until you have a Location.
>>
>> Second, you are using GPS, the way this is written. More specifically,
>> you are using the Criteria system, which will return GPS as a possible
>> provider. Given your specific Criteria setup, if GPS is available, it
>> probably is the best provider.
>>
>> --
>> Mark Murphy (a Commons Guy)
>> http://commonsware.com | http://github.com/commonsguy
>> http://commonsware.com/blog | http://twitter.com/commonsguy
>>
>> Android Training...At Your Office: http://commonsware.com/training
>>
>> --
>> 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+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
> --
> Raghav Sood
> http://www.raghavsood.com/
> http://www.androidappcheck.com/
> http://www.telstop.tel/
>
>


-- 
Raghav Sood
http://www.raghavsood.com/
http://www.androidappcheck.com/
http://www.telstop.tel/

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to