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
94d4266c
Commit
94d4266c
authored
Oct 27, 2022
by
Takatoshi Miura
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Task #49379【Android12】API31対応 Android12で機器連携するとアプリが落ちる
parent
4e5ddf88
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
5 deletions
+60
-5
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/Constant.java
+1
-0
ABVJE_Launcher_Android/AndroidManifest.xml
+4
-2
ABVJE_Res_Default_Android/res/values-ja/strings.xml
+2
-0
ABVJE_Res_Default_Android/res/values-ko/strings.xml
+3
-0
ABVJE_Res_Default_Android/res/values/strings.xml
+3
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ABookSettingFragment.java
+10
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
+37
-3
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/common/Constant.java
View file @
94d4266c
...
...
@@ -126,6 +126,7 @@ public class Constant {
int
AccessFineLocation
=
1
;
int
Camera
=
2
;
int
Audio
=
3
;
int
Bluetooth
=
4
;
}
public
interface
TaskReportLevel
{
...
...
ABVJE_Launcher_Android/AndroidManifest.xml
View file @
94d4266c
...
...
@@ -19,8 +19,10 @@
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<!-- an app to access precise location from location sources such as GPS, cell towers, and Wi-Fi -->
<uses-permission
android:name=
"android.permission.RECORD_AUDIO"
/>
<!-- AudioPlayView -->
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH_ADMIN"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH"
android:maxSdkVersion=
"30"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion=
"30"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH_SCAN"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH_CONNECT"
/>
<uses-permission
android:name=
"android.permission.NFC"
/>
<!-- QRCode -->
...
...
ABVJE_Res_Default_Android/res/values-ja/strings.xml
View file @
94d4266c
...
...
@@ -1452,4 +1452,6 @@
<!-- OZコンポーネント削除後 -->
<string
name=
"msg_error_open_ozd_content"
>
OZフォームで作成されているため、表示することができません。
</string>
<!-- API31対応後 -->
<string
name=
"msg_permission_dialog_bluetooth"
>
Bluetooth利用権限が必要です。\nアプリ設定画面へ遷移します。
</string>
</resources>
ABVJE_Res_Default_Android/res/values-ko/strings.xml
View file @
94d4266c
...
...
@@ -1460,4 +1460,6 @@
<!-- OZコンポーネント削除後 -->
<string
name=
"msg_error_open_ozd_content"
>
OZ 서식으로 작성되었으므로 표시할 수 없습니다.
</string>
<!-- API31対応後 -->
<string
name=
"msg_permission_dialog_bluetooth"
>
Bluetooth 이용권한이 필요합니다. \n앱설정화면으로 이동합니다.
</string>
</resources>
\ No newline at end of file
ABVJE_Res_Default_Android/res/values/strings.xml
View file @
94d4266c
...
...
@@ -1458,4 +1458,6 @@
<!-- OZコンポーネント削除後 -->
<string
name=
"msg_error_open_ozd_content"
>
Since it is created with an OZ form, it cannot be displayed.
</string>
<!-- API31対応後 -->
<string
name=
"msg_permission_dialog_bluetooth"
>
Bluetooth usage authority is required. \n To transition to the application setting screen.
</string>
</resources>
\ No newline at end of file
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/ABookSettingFragment.java
View file @
94d4266c
...
...
@@ -476,6 +476,11 @@ public class ABookSettingFragment extends PreferenceFragment {
chinoDevicePairing
.
setOnPreferenceClickListener
(
new
OnPreferenceClickListener
()
{
@Override
public
boolean
onPreferenceClick
(
Preference
preference
)
{
// アプリ側のBluetooth許可チェック
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
getActivity
(),
Constant
.
ABookPermissionType
.
Bluetooth
,
null
);
if
(!
helper
.
checkMultiPermissions
(
true
))
{
return
true
;
}
try
{
// ペアリング設定画面(BLE通信)
Intent
intent
=
new
Intent
();
...
...
@@ -494,6 +499,11 @@ public class ABookSettingFragment extends PreferenceFragment {
sppDevicePairing
.
setOnPreferenceClickListener
(
new
OnPreferenceClickListener
()
{
@Override
public
boolean
onPreferenceClick
(
Preference
preference
)
{
// アプリ側のBluetooth許可チェック
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
getActivity
(),
Constant
.
ABookPermissionType
.
Bluetooth
,
null
);
if
(!
helper
.
checkMultiPermissions
(
true
))
{
return
true
;
}
try
{
// ペアリング設定画面(SPP通信)
Intent
intent
=
new
Intent
();
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
View file @
94d4266c
...
...
@@ -82,9 +82,22 @@ public class ABookPermissionHelper {
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
RECORD_AUDIO
);
}
// Bluetooth
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
BLUETOOTH
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
BLUETOOTH
);
if
(
Build
.
VERSION
.
SDK_INT
>
30
)
{
// Android12以上の場合
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
BLUETOOTH_CONNECT
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
BLUETOOTH_CONNECT
);
}
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
BLUETOOTH_SCAN
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
BLUETOOTH_SCAN
);
}
}
else
{
// Android12未満の場合
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
BLUETOOTH
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
BLUETOOTH
);
}
}
return
reqPermissions
;
}
...
...
@@ -153,6 +166,27 @@ public class ABookPermissionHelper {
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
break
;
case
Constant
.
ABookPermissionType
.
Bluetooth
:
// Android12未満では実施しない
if
(
Build
.
VERSION
.
SDK_INT
<
31
)
{
break
;
}
// Bluetooth
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
BLUETOOTH_CONNECT
)
!=
PERMISSION_GRANTED
)
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_bluetooth
,
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
BLUETOOTH_SCAN
)
!=
PERMISSION_GRANTED
)
{
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_bluetooth
,
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
break
;
}
if
(
permitionTextResourceId
>
0
)
{
...
...
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