Commit cad7a1e5 by onuma

#47854 【@Form】Android12で機器連携するとアプリが落ちる

parent 01b1cdc0
......@@ -44,6 +44,7 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.SppDeviceDao;
import jp.agentec.abook.abv.bl.dto.SppDeviceDto;
import jp.agentec.abook.abv.cl.util.BleManagerUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.cl.util.SppBluetoothConnectThread;
import jp.agentec.abook.abv.cl.util.YamatoBluetoothReceiveTask;
import jp.agentec.abook.abv.launcher.android.R;
......@@ -528,14 +529,8 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
private void startOkudakeBeaconScan() {
//Linkingアプリと置くだけセンサーがBluetoothで通信するのでチェック必要
if (requestBluetoothFeature(REQUEST_CODE_ENABLEBLUETOOTH_OKUDAKE)) {
LocationManager lm = (LocationManager) this.getSystemService(this.LOCATION_SERVICE);
final boolean gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
final boolean secureLocationGpsEnabled = android.provider.Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED).contains("gps");
//端末側の位置情報許可チェック
if (gpsEnabled || secureLocationGpsEnabled) {
if (LocationManagerUtil.isLocationGpsEnabled(this)) {
ABookPermissionHelper helper = new ABookPermissionHelper(this, ABookPermissionType.AccessFineLocation, null);
//アプリ側の位置情報許可チェック(置くだけセンサーとLinkingアプリの通信できないため)
......
......@@ -30,6 +30,7 @@ import jp.agentec.abook.abv.bl.common.Constant.DeviceType;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.BluetoothPairingDeviceInfoDto;
import jp.agentec.abook.abv.cl.util.BleManagerUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
......@@ -218,19 +219,8 @@ public class BlePairingSettingActivity extends ABVUIActivity {
//BlueTooth許可チェック
if (!requestBluetoothFeature()) return;
LocationManager lm = (LocationManager) this.getSystemService(this.LOCATION_SERVICE);
boolean gpsEnabled = false;
if (lm != null) {
gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
} else {
Logger.w(TAG, "LocationManager is null");
}
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
final boolean secureLocationGpsEnabled = android.provider.Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED).contains("gps");
//端末側の位置情報許可チェック
if (!(gpsEnabled || secureLocationGpsEnabled)) {
//端末側の位置情報許可チェッ
if (!LocationManagerUtil.isLocationGpsEnabled(this)) {
showSimpleAlertDialog(R.string.chino_machine, R.string.msg_location_device_no_allow);
return;
}
......@@ -241,7 +231,7 @@ public class BlePairingSettingActivity extends ABVUIActivity {
// BluetoothLeScannerの取得
// ※Runnableオブジェクト内でも使用できるようfinalオブジェクトとする。
BluetoothLeScanner scanner = null;
BluetoothLeScanner scanner = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
scanner = bleManagerUtil.mBluetoothAdapter.getBluetoothLeScanner();
}
......
......@@ -31,6 +31,7 @@ import jp.agentec.abook.abv.bl.data.dao.SppDeviceDao;
import jp.agentec.abook.abv.bl.dto.BluetoothPairingDeviceInfoDto;
import jp.agentec.abook.abv.bl.dto.SppDeviceDto;
import jp.agentec.abook.abv.cl.util.BleManagerUtil;
import jp.agentec.abook.abv.cl.util.LocationManagerUtil;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.activity.ABVUIActivity;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
......@@ -175,14 +176,8 @@ public class SppBluetoothPairingSettingActivity extends ABVUIActivity {
//BlueTooth許可チェック
if (!requestBluetoothFeature()) return;
LocationManager lm = (LocationManager) this.getSystemService(this.LOCATION_SERVICE);
final boolean gpsEnabled = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
final boolean secureLocationGpsEnabled = android.provider.Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED).contains("gps");
//端末側の位置情報許可チェック
if (!(gpsEnabled || secureLocationGpsEnabled)) {
if (!LocationManagerUtil.isLocationGpsEnabled(this)) {
showSimpleAlertDialog(R.string.spp_machine, R.string.msg_location_device_no_allow);
return;
}
......
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