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
439fa0ef
Commit
439fa0ef
authored
Sep 17, 2024
by
Kim Jinsung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#60932 【Android 13 @form】バックグランドだと、プッシュメッセージが通知されない
添付ファイルの権限問題対応
parent
2396603b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
23 deletions
+89
-23
ABVJE_Launcher_Android/AndroidManifest.xml
+4
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVSplashActivity.java
+14
-8
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/appinfo/AppDefType.java
+1
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
+70
-15
No files found.
ABVJE_Launcher_Android/AndroidManifest.xml
View file @
439fa0ef
...
@@ -36,6 +36,10 @@
...
@@ -36,6 +36,10 @@
<permission
<permission
android:name=
"${applicationId}.permission.C2D_MESSAGE"
android:name=
"${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel=
"signature"
/>
android:protectionLevel=
"signature"
/>
<!-- Android13 -->
<uses-permission
android:name=
"android.permission.READ_MEDIA_VIDEO"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_IMAGES"
/>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<supports-screens
android:anyDensity=
"true"
android:xlargeScreens=
"true"
android:largeScreens=
"true"
android:normalScreens=
"true"
android:smallScreens=
"false"
/>
<supports-screens
android:anyDensity=
"true"
android:xlargeScreens=
"true"
android:largeScreens=
"true"
android:normalScreens=
"true"
android:smallScreens=
"false"
/>
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVSplashActivity.java
View file @
439fa0ef
...
@@ -57,19 +57,25 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity {
...
@@ -57,19 +57,25 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity {
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
boolean
chekcFlg
=
PreferenceUtil
.
getUserPref
(
this
,
AppDefType
.
UserPrefKey
.
ALL_PERMISSION_CHECK
,
true
);
boolean
chekcFlg
=
PreferenceUtil
.
getUserPref
(
this
,
AppDefType
.
UserPrefKey
.
ALL_PERMISSION_CHECK
,
true
);
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
this
);
if
(
chekcFlg
)
{
if
(
chekcFlg
)
{
PreferenceUtil
.
putUserPref
(
this
,
AppDefType
.
UserPrefKey
.
ALL_PERMISSION_CHECK
,
false
);
PreferenceUtil
.
putUserPref
(
this
,
AppDefType
.
UserPrefKey
.
ALL_PERMISSION_CHECK
,
false
);
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
this
);
mPermissionArray
=
helper
.
checkMultiPermissions
();
mPermissionArray
=
helper
.
checkMultiPermissions
();
if
(
mPermissionArray
.
size
()
==
0
)
{
abookMode
();
}
else
{
ActivityCompat
.
requestPermissions
(
this
,
mPermissionArray
.
toArray
(
new
String
[
mPermissionArray
.
size
()]),
REQUEST_PERMISSIONS
);
}
}
else
{
}
else
{
mPermissionArray
=
helper
.
checkAndroidVersionUpPermissions
();
}
commonCheckPermission
();
}
/**
* 権限チェック後、画面表示
*/
private
void
commonCheckPermission
()
{
if
(
mPermissionArray
.
size
()
==
0
)
{
abookMode
();
abookMode
();
}
else
{
ActivityCompat
.
requestPermissions
(
this
,
mPermissionArray
.
toArray
(
new
String
[
mPermissionArray
.
size
()]),
REQUEST_PERMISSIONS
);
}
}
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/appinfo/AppDefType.java
View file @
439fa0ef
...
@@ -77,6 +77,7 @@ public interface AppDefType {
...
@@ -77,6 +77,7 @@ public interface AppDefType {
String
OPERATION_GROUP_MASERT_ID
=
"operation_group_master_id"
;
// 作業種別のID
String
OPERATION_GROUP_MASERT_ID
=
"operation_group_master_id"
;
// 作業種別のID
String
OPERATION_SORT_CONDITION
=
"operation_sort_condition"
;
// 作業のソート
String
OPERATION_SORT_CONDITION
=
"operation_sort_condition"
;
// 作業のソート
String
OPERATION_AUTO_SYNC
=
"operationAutoSync"
;
String
OPERATION_AUTO_SYNC
=
"operationAutoSync"
;
String
ANDROID_13_PERMISSION_CHECK
=
"android13PermissionCheck"
;
}
}
/**
/**
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
View file @
439fa0ef
...
@@ -14,6 +14,7 @@ import java.util.ArrayList;
...
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import
jp.agentec.abook.abv.bl.common.Callback
;
import
jp.agentec.abook.abv.bl.common.Callback
;
import
jp.agentec.abook.abv.bl.common.Constant
;
import
jp.agentec.abook.abv.bl.common.Constant
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
import
jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog
;
import
jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog
;
import
jp.agentec.abook.abv.ui.common.util.AlertDialogUtil
;
import
jp.agentec.abook.abv.ui.common.util.AlertDialogUtil
;
...
@@ -44,6 +45,32 @@ public class ABookPermissionHelper {
...
@@ -44,6 +45,32 @@ public class ABookPermissionHelper {
public
ABookPermissionHelper
(
Context
context
)
{
public
ABookPermissionHelper
(
Context
context
)
{
mContext
=
context
;
mContext
=
context
;
}
}
/**
* AndroidOSバージョンアップ時の追加権限チェック
* @return 権限文字列の配列
*/
public
ArrayList
<
String
>
checkAndroidVersionUpPermissions
()
{
ArrayList
<
String
>
reqPermissions
=
new
ArrayList
<>();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
//Android13以上
boolean
chekcPermissionFlg
=
PreferenceUtil
.
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
ANDROID_13_PERMISSION_CHECK
,
true
);
if
(
chekcPermissionFlg
)
{
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_MEDIA_VIDEO
);
}
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_MEDIA_IMAGES
);
}
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
POST_NOTIFICATIONS
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
POST_NOTIFICATIONS
);
}
PreferenceUtil
.
putUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
ANDROID_13_PERMISSION_CHECK
,
false
);
}
}
return
reqPermissions
;
}
public
ArrayList
<
String
>
checkMultiPermissions
()
{
public
ArrayList
<
String
>
checkMultiPermissions
()
{
...
@@ -62,14 +89,31 @@ public class ABookPermissionHelper {
...
@@ -62,14 +89,31 @@ public class ABookPermissionHelper {
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
);
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
);
}
}
// ストレージ
// ストレージ
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
//Android13以上
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
);
android
.
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
}
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_MEDIA_VIDEO
);
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
}
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
);
android
.
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_MEDIA_IMAGES
);
}
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
POST_NOTIFICATIONS
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
POST_NOTIFICATIONS
);
}
PreferenceUtil
.
putUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
ANDROID_13_PERMISSION_CHECK
,
false
);
}
else
{
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
);
}
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
);
}
}
}
// カメラ
// カメラ
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
CAMERA
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
android
.
Manifest
.
permission
.
CAMERA
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
...
@@ -111,20 +155,31 @@ public class ABookPermissionHelper {
...
@@ -111,20 +155,31 @@ public class ABookPermissionHelper {
switch
(
mPermitionType
)
{
switch
(
mPermitionType
)
{
case
Constant
.
ABookPermissionType
.
ReadExternalStorage
:
case
Constant
.
ABookPermissionType
.
ReadExternalStorage
:
// ストレージ
// ストレージ
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
||
boolean
permissionGranted
=
true
;
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
//Android13以上
if
(
mContext
instanceof
HTMLWebViewActivity
||
mContext
instanceof
OperationListActivity
)
{
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
!=
PERMISSION_GRANTED
)
{
permissionGranted
=
false
;
}
}
else
{
// ストレージ
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
)
{
permissionGranted
=
false
;
}
}
if
(!
permissionGranted
)
{
if
(
mContext
instanceof
HTMLWebViewActivity
||
mContext
instanceof
OperationListActivity
)
{
// リソースパターンの適用
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_storage_album
,
R
.
string
.
msg_permission_dialog_storage_album
,
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
else
{
}
else
{
// リソースパターンの適用
// リソースパターンの適用
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
permitionTextResourceId
=
PatternStringUtil
.
patternToInt
(
mContext
,
R
.
string
.
msg_permission_dialog_storage_update
,
R
.
string
.
msg_permission_dialog_storage_update
,
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
getUserPref
(
mContext
,
AppDefType
.
UserPrefKey
.
RESOURCE_PATTERN_TYPE
,
0
));
}
}
}
}
break
;
break
;
case
Constant
.
ABookPermissionType
.
AccessFineLocation
:
case
Constant
.
ABookPermissionType
.
AccessFineLocation
:
...
...
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