2014-11-24 170 views
0

我想编写一个应用程序在后台运行,并提供更准确的GPS位置,当不可用时,它可能是这样的可能吗?更改GPS位置为Android

我明白,GPS位置可以覆盖开发人员模式,但我希望应用程序适用于所有人,而不仅仅是那些知道如何激活开发人员模式以及如何处理它的人。

+0

退房一体化位置提供https://developer.android.com/training/location/index.html – goonerDroid 2014-11-24 08:46:13

+0

http://stackoverflow.com/a/24118994/3292795 – prabhakaran 2014-11-24 08:49:04

回答

0
LocationManager alm=(LocationManager) this.getSystemService(Context.LOCATION_SERVICE); 
    if(alm.isProviderEnabled(LocationManager.GPS_PROVIDER)){ 
     Toast.makeText(this, "GPS is available", Toast.LENGTH_SHORT).show(); 

    }else{ 

     Toast.makeText(this, "please open the GPS ", Toast.LENGTH_SHORT).show(); 
     Intent intent=new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); 
     startActivityForResult(intent, 0); 
    }