Turn GPS on and off

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Turn GPS on and off

Postby saphiroth » Thu Dec 18, 2008 6:16 pm

Hello,

I was wondering if there is a way to turn the gps on and off programatically using googls location api.

Thank you for the help!
saphiroth
Junior Developer
Junior Developer
 
Posts: 12
Joined: Fri Oct 31, 2008 5:22 pm

Top

Postby tum0rc0re » Sun Dec 21, 2008 7:00 am

Here you'll find programmatically enabling/disabling GPS - http://www.maximyudin.com/2008/12/07/an ... rogrammno/. It's russian article but there's a code of two functions :)
JQ Soft web page:
[b][url=http://jqsoft.ru/]http://jqsoft.ru/[/url][/b]
My proffesional blog: [b][url=http://maximyudin.blogspot.com]http://maximyudin.blogspot.com[/url][/b]
Facebook: [b][url=http://www.facebook.com/maxim.yudin]http://www.facebook.com/maxim.yudin[/url][/b]
User avatar
tum0rc0re
Senior Developer
Senior Developer
 
Posts: 158
Joined: Sun Nov 25, 2007 7:15 am
Location: Moscow, Russia

Postby avolovoy » Sun Dec 21, 2008 3:59 pm

Maxim, that uses a reflection. And as you've stated correctly that is closed in r2. Stay on older release is not an option for developers - after all we're writing for average user to be able to use our apps.
I think we need to look at sources of the cupcake to see if google will provide give an Api to turn it on and off.
ЗЫ
надеюсь русский текст в exceptions не стандартная практика ( should be in strings anyway) иначе народ сильно удивится :)
Alexey Volovoy
Bytesharp.NET
User avatar
avolovoy
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Nov 03, 2008 10:32 pm
Location: kansas

Postby avolovoy » Mon Dec 22, 2008 6:33 am

Ok guys..
1) Look at Maxim's code, up to the point where it's using reflection. (or look at the source of settings screen at
http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=blob_plain;f=src/com/android/settings/SecuritySettings.java;hb=HEAD
)
2) Google,,, google google ..
3) And we find a blog of the Toggle author ...http://andrewoid.blogspot.com/
4) Replace reflection call with to lines of code from the blog
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.             Intent intent = new Intent(Intent.ACTION_PROVIDER_CHANGED);
  3.  
  4.             sendBroadcast(intent);
  5.  
  6.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

And it works.
PLEASE - DON'T PUT "new" Togglestuff apps on the market - we have enough.
Alexey Volovoy
Bytesharp.NET
User avatar
avolovoy
Experienced Developer
Experienced Developer
 
Posts: 68
Joined: Mon Nov 03, 2008 10:32 pm
Location: kansas

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 4 guests