Commit 6551ebdd by Lee Jaebin

テストGPS

parent 24f71b3d
......@@ -6,14 +6,12 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanResult;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
......@@ -210,26 +208,12 @@ public class PairingSettingActivity extends ABVUIActivity {
//BlueTooth許可チェック
if (!requestBluetoothFeature()) return;
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationManager lm = (LocationManager) getApplicationContext().getSystemService(this.LOCATION_SERVICE);
final boolean gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
final boolean network = lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
Logger.i("-------------------lm : " + (lm != null ? "is not null" : "is null"));
Logger.i("-------------------gpsEnabled : " + gpsEnabled);
Logger.i("-------------------network : " + network);
String gpsStatus = android.provider.Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
if (gpsStatus.indexOf("gps", 0) < 0) {
// Toastを表示
Toast.makeText(getApplicationContext(), "GPSは無効です",
Toast.LENGTH_LONG).show();
//端末側の位置情報許可チェック
if (!gpsEnabled) {
showSimpleAlertDialog(R.string.set_pairing_central_thermometer, R.string.msg_location_device_no_allow);
return;
} else {
// GPSが有効だった場合
// Toastを表示
Toast.makeText(getApplicationContext(), "GPSは有効です",
Toast.LENGTH_LONG).show();
}
ABookPermissionHelper helper = new ABookPermissionHelper(this, Constant.ABookPermissionType.AccessFineLocation, null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment