Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
cad7a1e5
Commit
cad7a1e5
authored
May 25, 2022
by
onuma
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#47854 【@Form】Android12で機器連携するとアプリが落ちる
parent
01b1cdc0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
89 deletions
+134
-89
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/LocationManagerUtil.java
+126
-61
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
+2
-7
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/BlePairingSettingActivity.java
+4
-14
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/SppBluetoothPairingSettingActivity.java
+2
-7
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/LocationManagerUtil.java
View file @
cad7a1e5
...
@@ -4,7 +4,6 @@ import java.util.Date;
...
@@ -4,7 +4,6 @@ import java.util.Date;
import
java.util.Timer
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
java.util.TimerTask
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.launcher.android.ABVApplication
;
import
jp.agentec.abook.abv.launcher.android.ABVApplication
;
import
jp.agentec.abook.abv.launcher.android.ABVUIDataCache
;
import
jp.agentec.abook.abv.launcher.android.ABVUIDataCache
;
...
@@ -18,6 +17,7 @@ import android.content.Intent;
...
@@ -18,6 +17,7 @@ import android.content.Intent;
import
android.location.Location
;
import
android.location.Location
;
import
android.location.LocationListener
;
import
android.location.LocationListener
;
import
android.location.LocationManager
;
import
android.location.LocationManager
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.provider.Settings
;
import
android.provider.Settings
;
...
@@ -50,9 +50,57 @@ public class LocationManagerUtil {
...
@@ -50,9 +50,57 @@ public class LocationManagerUtil {
}
}
/**
/**
* GPSが有効かチェックする
* @return 有効の場合true
*/
public
boolean
isLocationGpsEnabled
()
{
locationManager
=
(
LocationManager
)
context
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
if
(
locationManager
==
null
)
{
return
false
;
}
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
boolean
secureLocationGpsEnabled
;
if
(
Build
.
VERSION
.
SDK_INT
<
31
)
{
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
secureLocationGpsEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
contains
(
"gps"
);
}
else
{
secureLocationGpsEnabled
=
gps
;
}
if
(!
gps
||
!
secureLocationGpsEnabled
)
{
return
false
;
}
return
true
;
}
/**
* NetWorkによる位置測定が有効かチェックする
* @return 有効の場合true
*/
public
boolean
isLocationNetWorkEnabled
()
{
locationManager
=
(
LocationManager
)
context
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
if
(
locationManager
==
null
)
{
return
false
;
}
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
boolean
secureLocationNetWorkEnabled
;
if
(
Build
.
VERSION
.
SDK_INT
<
31
)
{
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
secureLocationNetWorkEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
contains
(
"network"
);
}
else
{
secureLocationNetWorkEnabled
=
network
;
}
if
(!
network
||
!
secureLocationNetWorkEnabled
)
{
return
false
;
}
return
true
;
}
/**
* 位置情報の取得を開始します<br>
* 位置情報の取得を開始します<br>
* 成功時にlistenerのonGetLocation、失敗時にlistenerのonGetLocationFailedが呼び出されます。
* 成功時にlistenerのonGetLocation、失敗時にlistenerのonGetLocationFailedが呼び出されます。
*
*
*/
*/
public
void
startLocationService
()
{
public
void
startLocationService
()
{
stopLocationService
();
stopLocationService
();
...
@@ -65,55 +113,50 @@ public class LocationManagerUtil {
...
@@ -65,55 +113,50 @@ public class LocationManagerUtil {
setLocationFailed
();
setLocationFailed
();
return
;
return
;
}
}
// 位置情報サービスが有効か?
boolean
isGpsEnabled
=
isLocationGpsEnabled
();
boolean
isNetWorkEnabled
=
isLocationNetWorkEnabled
();
if
(!(
isGpsEnabled
||
isNetWorkEnabled
))
{
// この時点で位置情報サービスが有効でない場合は何もしない。
setLocationFailed
();
return
;
}
final
Location
lastKnownLocation
=
getLastKnownLocation
();
if
(
lastKnownLocation
!=
null
)
{
// 最後に取得できた位置情報があれば、とりあえず設定します。
updateLocation
(
lastKnownLocation
,
true
);
// 最後に取得できた位置情報が5分以内のものであれば、これ以上処理を実行しません。
if
((
new
Date
().
getTime
()
-
lastKnownLocation
.
getTime
())
<
SIGNIFICANTLY_NEWER
)
{
return
;
}
}
final
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
time
=
0L
;
final
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
// 位置情報取得の生存時間を決定するタイマーを起動します。
final
Handler
handler
=
new
Handler
();
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
locationTimer
=
new
Timer
(
true
);
final
boolean
secureLocationGpsEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
contains
(
"gps"
);
locationTimer
.
scheduleAtFixedRate
(
new
TimerTask
()
{
final
boolean
secureLocationNetWorkEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
contains
(
"network"
);
@Override
public
void
run
()
{
if
(!(
gps
||
network
)
||
!(
secureLocationGpsEnabled
||
secureLocationNetWorkEnabled
))
{
handler
.
post
(
new
Runnable
()
{
// この時点で位置情報サービスが有効でない場合は何もしない。
@Override
setLocationFailed
();
public
void
run
()
{
return
;
if
(
time
>
SERVICE_TIMEOUT
)
{
}
Logger
.
w
(
TAG
,
"time > SERVICE_TIMEOUT"
);
setLocationFailed
();
final
Location
lastKnownLocation
=
getLastKnownLocation
();
return
;
if
(
lastKnownLocation
!=
null
)
{
}
// 最後に取得できた位置情報があれば、とりあえず設定します。
time
=
time
+
TIMER_INTERVAL
;
updateLocation
(
lastKnownLocation
,
true
);
}
});
// 最後に取得できた位置情報が5分以内のものであれば、これ以上処理を実行しません。
}
if
((
new
Date
().
getTime
()
-
lastKnownLocation
.
getTime
())
<
SIGNIFICANTLY_NEWER
)
{
},
TIMER_DELAY
,
TIMER_INTERVAL
);
return
;
}
// 位置情報の取得を開始します。
}
if
(
isGpsEnabled
)
{
time
=
0L
;
// 位置情報取得の生存時間を決定するタイマーを起動します。
final
Handler
handler
=
new
Handler
();
locationTimer
=
new
Timer
(
true
);
locationTimer
.
scheduleAtFixedRate
(
new
TimerTask
()
{
@Override
public
void
run
()
{
handler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
time
>
SERVICE_TIMEOUT
)
{
Logger
.
w
(
TAG
,
"time > SERVICE_TIMEOUT"
);
setLocationFailed
();
return
;
}
time
=
time
+
TIMER_INTERVAL
;
}
});
}
},
TIMER_DELAY
,
TIMER_INTERVAL
);
// 位置情報の取得を開始します。
if
(
gps
)
{
gpsLocationListener
=
new
LocationListener
()
{
gpsLocationListener
=
new
LocationListener
()
{
@Override
@Override
public
void
onLocationChanged
(
final
Location
location
)
{
public
void
onLocationChanged
(
final
Location
location
)
{
...
@@ -137,7 +180,7 @@ public class LocationManagerUtil {
...
@@ -137,7 +180,7 @@ public class LocationManagerUtil {
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
0
,
0
,
gpsLocationListener
);
locationManager
.
requestLocationUpdates
(
LocationManager
.
GPS_PROVIDER
,
0
,
0
,
gpsLocationListener
);
}
}
if
(
network
)
{
if
(
isNetWorkEnabled
)
{
networkLocationListener
=
new
LocationListener
()
{
networkLocationListener
=
new
LocationListener
()
{
@Override
@Override
public
void
onLocationChanged
(
final
Location
location
)
{
public
void
onLocationChanged
(
final
Location
location
)
{
...
@@ -186,7 +229,7 @@ public class LocationManagerUtil {
...
@@ -186,7 +229,7 @@ public class LocationManagerUtil {
/**
/**
* 第一引数の位置情報に比べ、第二引数の位置情報がより有効であるか判定します。
* 第一引数の位置情報に比べ、第二引数の位置情報がより有効であるか判定します。
*
*
* @param currentLocation
* @param currentLocation
* @param newLocation
* @param newLocation
* @return
* @return
...
@@ -219,14 +262,14 @@ public class LocationManagerUtil {
...
@@ -219,14 +262,14 @@ public class LocationManagerUtil {
}
}
return
false
;
return
false
;
}
}
public
static
boolean
isSameProvider
(
final
String
provider1
,
final
String
provider2
)
{
public
static
boolean
isSameProvider
(
final
String
provider1
,
final
String
provider2
)
{
if
(
provider1
==
null
)
{
if
(
provider1
==
null
)
{
return
provider2
==
null
;
return
provider2
==
null
;
}
}
return
provider1
.
equals
(
provider2
);
return
provider1
.
equals
(
provider2
);
}
}
void
updateLocation
(
final
Location
location
,
final
boolean
lastKnownLocation
)
{
void
updateLocation
(
final
Location
location
,
final
boolean
lastKnownLocation
)
{
currentLocation
=
location
;
currentLocation
=
location
;
setLocation
(
location
);
setLocation
(
location
);
...
@@ -238,14 +281,11 @@ public class LocationManagerUtil {
...
@@ -238,14 +281,11 @@ public class LocationManagerUtil {
public
void
showLoactionServiceAlert
()
{
public
void
showLoactionServiceAlert
()
{
locationManager
=
(
LocationManager
)
context
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
locationManager
=
(
LocationManager
)
context
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
if
(
locationManager
!=
null
)
{
if
(
locationManager
!=
null
)
{
final
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
// 位置情報サービスが有効か?
final
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
boolean
isGpsEnabled
=
isLocationGpsEnabled
();
boolean
isNetWorkEnabled
=
isLocationNetWorkEnabled
();
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
if
(!(
isGpsEnabled
||
isNetWorkEnabled
))
{
final
boolean
secureLocationGpsEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
contains
(
"gps"
);
final
boolean
secureLocationNetWorkEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
contains
(
"network"
);
if
(!(
gps
||
network
)
||
!(
secureLocationGpsEnabled
||
secureLocationNetWorkEnabled
))
{
ABVUIDataCache
appDataCache
=
ABVApplication
.
getABVUIDataCache
(
context
);
ABVUIDataCache
appDataCache
=
ABVApplication
.
getABVUIDataCache
(
context
);
if
(
appDataCache
.
checkLocationServiceFlg
)
{
if
(
appDataCache
.
checkLocationServiceFlg
)
{
// 位置情報が有効になっていない場合は、Google Maps アプリライクなダイアログを起動します。
// 位置情報が有効になっていない場合は、Google Maps アプリライクなダイアログを起動します。
...
@@ -305,4 +345,29 @@ public class LocationManagerUtil {
...
@@ -305,4 +345,29 @@ public class LocationManagerUtil {
listener
.
onGetLocationFailed
();
listener
.
onGetLocationFailed
();
}
}
}
}
/**
* GPSが有効でかどうかをチェックします。
* @param context アプリのcontext
* @return 有効の場合はtrue
*/
public
static
boolean
isLocationGpsEnabled
(
Context
context
)
{
LocationManager
locationManager
=
(
LocationManager
)
context
.
getSystemService
(
Context
.
LOCATION_SERVICE
);
if
(
locationManager
==
null
)
{
return
false
;
}
boolean
gpsEnabled
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
boolean
secureLocationGpsEnabled
;
if
(
Build
.
VERSION
.
SDK_INT
<
31
)
{
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
secureLocationGpsEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
contains
(
"gps"
);
}
else
{
secureLocationGpsEnabled
=
gpsEnabled
;
}
if
(!(
gpsEnabled
||
secureLocationGpsEnabled
))
{
return
false
;
}
return
true
;
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
View file @
cad7a1e5
...
@@ -44,6 +44,7 @@ import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
...
@@ -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.data.dao.SppDeviceDao
;
import
jp.agentec.abook.abv.bl.dto.SppDeviceDto
;
import
jp.agentec.abook.abv.bl.dto.SppDeviceDto
;
import
jp.agentec.abook.abv.cl.util.BleManagerUtil
;
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.SppBluetoothConnectThread
;
import
jp.agentec.abook.abv.cl.util.YamatoBluetoothReceiveTask
;
import
jp.agentec.abook.abv.cl.util.YamatoBluetoothReceiveTask
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.launcher.android.R
;
...
@@ -528,14 +529,8 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
...
@@ -528,14 +529,8 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
private
void
startOkudakeBeaconScan
()
{
private
void
startOkudakeBeaconScan
()
{
//Linkingアプリと置くだけセンサーがBluetoothで通信するのでチェック必要
//Linkingアプリと置くだけセンサーがBluetoothで通信するのでチェック必要
if
(
requestBluetoothFeature
(
REQUEST_CODE_ENABLEBLUETOOTH_OKUDAKE
))
{
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
);
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
this
,
ABookPermissionType
.
AccessFineLocation
,
null
);
//アプリ側の位置情報許可チェック(置くだけセンサーとLinkingアプリの通信できないため)
//アプリ側の位置情報許可チェック(置くだけセンサーとLinkingアプリの通信できないため)
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/BlePairingSettingActivity.java
View file @
cad7a1e5
...
@@ -30,6 +30,7 @@ import jp.agentec.abook.abv.bl.common.Constant.DeviceType;
...
@@ -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.common.log.Logger
;
import
jp.agentec.abook.abv.bl.dto.BluetoothPairingDeviceInfoDto
;
import
jp.agentec.abook.abv.bl.dto.BluetoothPairingDeviceInfoDto
;
import
jp.agentec.abook.abv.cl.util.BleManagerUtil
;
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.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.activity.ABVUIActivity
;
import
jp.agentec.abook.abv.ui.common.activity.ABVUIActivity
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
...
@@ -218,19 +219,8 @@ public class BlePairingSettingActivity extends ABVUIActivity {
...
@@ -218,19 +219,8 @@ public class BlePairingSettingActivity extends ABVUIActivity {
//BlueTooth許可チェック
//BlueTooth許可チェック
if
(!
requestBluetoothFeature
())
return
;
if
(!
requestBluetoothFeature
())
return
;
LocationManager
lm
=
(
LocationManager
)
this
.
getSystemService
(
this
.
LOCATION_SERVICE
);
//端末側の位置情報許可チェッ
boolean
gpsEnabled
=
false
;
if
(!
LocationManagerUtil
.
isLocationGpsEnabled
(
this
))
{
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
))
{
showSimpleAlertDialog
(
R
.
string
.
chino_machine
,
R
.
string
.
msg_location_device_no_allow
);
showSimpleAlertDialog
(
R
.
string
.
chino_machine
,
R
.
string
.
msg_location_device_no_allow
);
return
;
return
;
}
}
...
@@ -241,7 +231,7 @@ public class BlePairingSettingActivity extends ABVUIActivity {
...
@@ -241,7 +231,7 @@ public class BlePairingSettingActivity extends ABVUIActivity {
// BluetoothLeScannerの取得
// BluetoothLeScannerの取得
// ※Runnableオブジェクト内でも使用できるようfinalオブジェクトとする。
// ※Runnableオブジェクト内でも使用できるようfinalオブジェクトとする。
BluetoothLeScanner
scanner
=
null
;
BluetoothLeScanner
scanner
=
null
;
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
scanner
=
bleManagerUtil
.
mBluetoothAdapter
.
getBluetoothLeScanner
();
scanner
=
bleManagerUtil
.
mBluetoothAdapter
.
getBluetoothLeScanner
();
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/SppBluetoothPairingSettingActivity.java
View file @
cad7a1e5
...
@@ -31,6 +31,7 @@ import jp.agentec.abook.abv.bl.data.dao.SppDeviceDao;
...
@@ -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.BluetoothPairingDeviceInfoDto
;
import
jp.agentec.abook.abv.bl.dto.SppDeviceDto
;
import
jp.agentec.abook.abv.bl.dto.SppDeviceDto
;
import
jp.agentec.abook.abv.cl.util.BleManagerUtil
;
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.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.activity.ABVUIActivity
;
import
jp.agentec.abook.abv.ui.common.activity.ABVUIActivity
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
import
jp.agentec.abook.abv.ui.common.util.ABVToastUtil
;
...
@@ -175,14 +176,8 @@ public class SppBluetoothPairingSettingActivity extends ABVUIActivity {
...
@@ -175,14 +176,8 @@ public class SppBluetoothPairingSettingActivity extends ABVUIActivity {
//BlueTooth許可チェック
//BlueTooth許可チェック
if
(!
requestBluetoothFeature
())
return
;
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
);
showSimpleAlertDialog
(
R
.
string
.
spp_machine
,
R
.
string
.
msg_location_device_no_allow
);
return
;
return
;
}
}
...
...
Takatoshi Miura
@miura-t
mentioned in merge request
!257 (merged)
Oct 13, 2022
mentioned in merge request
!257 (merged)
mentioned in merge request !257
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment