android - Read the status of GPS on pressing home button in oncreate() -


in application on button click i'm making gps "on" or "off"

if gps on if press home button, application go background when application comes foreground once again gps should in enabled(on) position

something this

  final locationmanager locationmanager = (locationmanager) getsystemservice(location_service);      boolean statusofgps = locationmanager.isproviderenabled(locationmanager.gps_provider);      if(statusofgps == true){               keep gps in "on" position      }      else if(statusofgps == false){         keep gps in "off" position     }  

how can implement in oncreate() , when application starts can set gps on or off reading state

help appreciated! thanks

you can create new thread, periodically check (for example once every 5 seconds) status , correspondingly update gps.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -