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
438b3dad
Commit
438b3dad
authored
Jun 13, 2019
by
Lee Jaebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
設定画面の位置情報 ON\OFF 取得方法の追加(getSystemServiceから取得できないため、どっちかがtureの場合、位置情報をONと見做す)
parent
28097a96
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/LocationManagerUtil.java
+11
-2
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
+5
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/PairingSettingActivity.java
+6
-1
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/util/LocationManagerUtil.java
View file @
438b3dad
...
@@ -4,6 +4,7 @@ import java.util.Date;
...
@@ -4,6 +4,7 @@ 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
;
...
@@ -19,6 +20,7 @@ import android.location.LocationListener;
...
@@ -19,6 +20,7 @@ import android.location.LocationListener;
import
android.location.LocationManager
;
import
android.location.LocationManager
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.provider.Settings
;
public
class
LocationManagerUtil
{
public
class
LocationManagerUtil
{
private
final
String
TAG
=
"LocationManagerUtil"
;
private
final
String
TAG
=
"LocationManagerUtil"
;
...
@@ -67,7 +69,10 @@ public class LocationManagerUtil {
...
@@ -67,7 +69,10 @@ public class LocationManagerUtil {
final
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
final
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
final
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
final
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
if
(!
gps
&&
!
network
)
{
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
final
boolean
secureLocationGpsEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
indexOf
(
"gps"
,
0
)
>=
0
;
if
(!(
gps
||
network
)
||
!(
secureLocationGpsEnabled
||
ABVEnvironment
.
getInstance
().
networkAdapter
.
isNetworkConnected
()))
{
// この時点で位置情報サービスが有効でない場合は何もしない。
// この時点で位置情報サービスが有効でない場合は何もしない。
setLocationFailed
();
setLocationFailed
();
return
;
return
;
...
@@ -234,7 +239,11 @@ public class LocationManagerUtil {
...
@@ -234,7 +239,11 @@ public class LocationManagerUtil {
if
(
locationManager
!=
null
)
{
if
(
locationManager
!=
null
)
{
final
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
final
boolean
gps
=
locationManager
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
final
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
final
boolean
network
=
locationManager
.
isProviderEnabled
(
LocationManager
.
NETWORK_PROVIDER
);
if
(!
gps
&&
!
network
)
{
// GPSの状態を取得(getSystemtServiceからのGPS ON/OFF取得が取れない場合があるため、secureで取得したgpsも判定するため)
final
boolean
secureLocationGpsEnabled
=
android
.
provider
.
Settings
.
Secure
.
getString
(
context
.
getContentResolver
(),
Settings
.
Secure
.
LOCATION_PROVIDERS_ALLOWED
).
indexOf
(
"gps"
,
0
)
>=
0
;
if
(!(
gps
||
network
)
||
!(
secureLocationGpsEnabled
||
ABVEnvironment
.
getInstance
().
networkAdapter
.
isNetworkConnected
()))
{
ABVUIDataCache
appDataCache
=
ABVApplication
.
getABVUIDataCache
(
context
);
ABVUIDataCache
appDataCache
=
ABVApplication
.
getABVUIDataCache
(
context
);
if
(
appDataCache
.
checkLocationServiceFlg
)
{
if
(
appDataCache
.
checkLocationServiceFlg
)
{
// 位置情報が有効になっていない場合は、Google Maps アプリライクなダイアログを起動します。
// 位置情報が有効になっていない場合は、Google Maps アプリライクなダイアログを起動します。
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVCheckContentViewActivity.java
View file @
438b3dad
...
@@ -11,6 +11,7 @@ import android.media.AudioManager;
...
@@ -11,6 +11,7 @@ import android.media.AudioManager;
import
android.media.MediaPlayer
;
import
android.media.MediaPlayer
;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.provider.Settings
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.nttdocomo.android.sdaiflib.BeaconData
;
import
com.nttdocomo.android.sdaiflib.BeaconData
;
...
@@ -297,8 +298,11 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
...
@@ -297,8 +298,11 @@ public class ABVCheckContentViewActivity extends ABVContentViewActivity {
LocationManager
lm
=
(
LocationManager
)
this
.
getSystemService
(
this
.
LOCATION_SERVICE
);
LocationManager
lm
=
(
LocationManager
)
this
.
getSystemService
(
this
.
LOCATION_SERVICE
);
final
boolean
gpsEnabled
=
lm
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
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
).
indexOf
(
"gps"
,
0
)
>=
0
;
//端末側の位置情報許可チェック
//端末側の位置情報許可チェック
if
(
gpsEnabled
)
{
if
(
gpsEnabled
||
secureLocationGpsEnabled
)
{
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
this
,
Constant
.
ABookPermissionType
.
AccessFineLocation
,
null
);
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
this
,
Constant
.
ABookPermissionType
.
AccessFineLocation
,
null
);
//アプリ側の位置情報許可チェック(置くだけセンサーとLinkingアプリの通信できないため)
//アプリ側の位置情報許可チェック(置くだけセンサーとLinkingアプリの通信できないため)
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/PairingSettingActivity.java
View file @
438b3dad
...
@@ -12,6 +12,7 @@ import android.location.LocationManager;
...
@@ -12,6 +12,7 @@ import android.location.LocationManager;
import
android.os.Build
;
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.view.View
;
import
android.view.View
;
import
android.widget.AdapterView
;
import
android.widget.AdapterView
;
import
android.widget.Button
;
import
android.widget.Button
;
...
@@ -210,8 +211,12 @@ public class PairingSettingActivity extends ABVUIActivity {
...
@@ -210,8 +211,12 @@ public class PairingSettingActivity extends ABVUIActivity {
LocationManager
lm
=
(
LocationManager
)
this
.
getSystemService
(
this
.
LOCATION_SERVICE
);
LocationManager
lm
=
(
LocationManager
)
this
.
getSystemService
(
this
.
LOCATION_SERVICE
);
final
boolean
gpsEnabled
=
lm
.
isProviderEnabled
(
LocationManager
.
GPS_PROVIDER
);
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
).
indexOf
(
"gps"
,
0
)
>=
0
;
//端末側の位置情報許可チェック
//端末側の位置情報許可チェック
if
(!
gpsEnabled
)
{
if
(!
(
gpsEnabled
||
secureLocationGpsEnabled
)
)
{
showSimpleAlertDialog
(
R
.
string
.
set_pairing_central_thermometer
,
R
.
string
.
msg_location_device_no_allow
);
showSimpleAlertDialog
(
R
.
string
.
set_pairing_central_thermometer
,
R
.
string
.
msg_location_device_no_allow
);
return
;
return
;
}
}
...
...
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