2014-11-24 237 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); 
    }