Android detect location settings -


i'm using new location api in app , i'm wondering how detect if user has location access enabled on there phone.

i'm setting locationclient , running locationrequest. how run check before doing see if can users location?

in onconnected call method these:

private boolean checklocationproviders() {     if(mlocationmanager.isproviderenabled(locationmanager.network_provider))     {         return true;     }     else     {         if(mlocationmanager.isproviderenabled(locationmanager.gps_provider))             return true;         else             return false;     } } 

if false returned, can open settings screen in way:

startactivity(new intent(settings.action_location_source_settings)); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -