El vie, 18-09-2009 a las 19:35 -0400, Mark Murphy escribió:
> niksbin wrote:
> > Hi Everyone,
> > 
> > I was doing some research on the web.  I found this program that helps
> > if the Android-phone is lost or stolen.  However, the description
> > indicates that automatically enabling GPS is not possible within/via
> > the app?  Here is the URL for the app I found:
> > 
> > http://www.androlib.com/android.application.org-ajeje-locservice15-zxw.aspx
> > 
> > Can you tell me if this is true? 
> 
> Yes.
> 
> > If so, is there a work-around to
> > this as a feature for a GPS app?
> 
> No.
Sorry Mark, with all my respect I have to disagree with you.
I'm not sure whether this is some deep secret (I guess not, because I
borrowed this code from Settings app):
 String allowedProviders = LocationManager.GPS_PROVIDER + "," +
LocationManager.NETWORK_PROVIDER;
Settings.Secure.putString(getContentResolver(),
Settings.Secure.LOCATION_PROVIDERS_ALLOWED, allowedProviders);

This will enable both GPS and Network providers (at least in 1.5, I
haven't tried 1.6 yet).

I also searched in the forums and mailing lists to find how to do that
and I read some explanations like "doing it automatically without user's
knowledge is _forbidden_ because this effects the battery life". I think
the same explanation is valid for WIFI but to enable it I just need to
call WifiManager.setEnabled(true).

The idea with <uses-permission> is good enough for me. Before installing
any application the platform tells me "this app requests these and those
permissions. do you want to give them to it?". For me as a techy this is
enough to reject access to "INTERNET" and "SYSTEM_TOOLS" for some game I
was going to install. But my application has completely different
purpose and everything is well described in its description and I need
GPS and/or WIFI and I don't see anything wrong with requesting
permissions to change their state at installation time. 

> 
> > I was actually thinking of creating
> > a location-based app, but am surprised to see this.
> 
> If the user disables GPS, that is the user's right.
> 
> If the user has GPS enabled, the GPS radio is still normally off, for
> battery reasons, but it will automatically turn on once you request
> location updates or something. Similarly, the radio will automatically
> turn off once you stop using it.
> 


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

Reply via email to