跳到主要內容

Android 檢查GPS

首先要記得有取得GPS的權限
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

才能檢查GPS有無開啟的狀態
public boolean isGPSEnables () {
    LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
}

純粹紀錄一下檢查GPS有無開啟的程式碼~

留言

這個網誌中的熱門文章

What is phpize

What is phpize According to the PHP official document : The phpize command is used to prepare the build environment for a PHP extension. If you need to build such an extension that from github or another code repositories, you can use  build tools to perform the build manually.