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
6c7935c6
Commit
6c7935c6
authored
Aug 29, 2024
by
Kim Jinsung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Android13端末対応で、通知権限とストレージファイル参照権限を追加
parent
e2ebd58c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
15 deletions
+106
-15
ABVJE_Launcher_Android/AndroidManifest.xml
+3
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/cl/helper/AppMigrationHelper.java
+56
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVSplashActivity.java
+6
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
+41
-15
No files found.
ABVJE_Launcher_Android/AndroidManifest.xml
View file @
6c7935c6
...
@@ -40,6 +40,9 @@
...
@@ -40,6 +40,9 @@
<permission
<permission
android:name=
"${applicationId}.permission.C2D_MESSAGE"
android:name=
"${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel=
"signature"
/>
android:protectionLevel=
"signature"
/>
<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/cl/helper/AppMigrationHelper.java
0 → 100644
View file @
6c7935c6
package
jp
.
agentec
.
abook
.
abv
.
cl
.
helper
;
import
android.content.Context
;
import
java.util.Arrays
;
import
java.util.List
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
interface
MigrationVersion
{
//Android13対応で、「通知」「イメージ・動画」権限追加され、バージョンアップ後、起動時に再度権限ダイアログ表示する処理追加
String
VER_1_4_520
=
"VER_1_4_520"
;
}
/**
* アプリ内のマイグレーション処理クラス
*/
public
class
AppMigrationHelper
{
private
static
final
String
TAG
=
"AppMigrationHelper"
;
private
static
final
String
[]
MIGRATION_ARRAY
=
{
MigrationVersion
.
VER_1_4_520
};
/**
* アプリマイグレーションを実行
* @param context コンテキスト
*/
public
void
runMigration
(
Context
context
)
{
Logger
.
d
(
TAG
,
"runMigration"
);
boolean
chekcFlg
=
PreferenceUtil
.
getUserPref
(
context
,
AppDefType
.
UserPrefKey
.
ALL_PERMISSION_CHECK
,
true
);
List
<
String
>
migrationList
=
Arrays
.
asList
(
MIGRATION_ARRAY
);
for
(
String
version
:
migrationList
)
{
if
(
chekcFlg
)
{
//新規インストール&データ初期化
PreferenceUtil
.
put
(
context
,
version
,
true
);
}
else
{
//上書きインストール
boolean
migrationFinished
=
PreferenceUtil
.
getUserPref
(
context
,
version
,
false
);
if
(!
migrationFinished
)
{
if
(
version
.
equals
(
MigrationVersion
.
VER_1_4_520
))
{
resetAllPermissionCheckFlg
(
context
);
}
PreferenceUtil
.
putUserPref
(
context
,
version
,
true
);
}
}
}
}
/**
* アプリ起動時の権限チェック済みフラグを初期化
* @param context コンテキスト
*/
private
void
resetAllPermissionCheckFlg
(
Context
context
)
{
Logger
.
i
(
TAG
,
"resetPermissionCheck"
);
PreferenceUtil
.
putUserPref
(
context
,
AppDefType
.
UserPrefKey
.
ALL_PERMISSION_CHECK
,
true
);
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVSplashActivity.java
View file @
6c7935c6
...
@@ -19,6 +19,7 @@ import jp.agentec.abook.abv.bl.download.ContentDownloader;
...
@@ -19,6 +19,7 @@ import jp.agentec.abook.abv.bl.download.ContentDownloader;
import
jp.agentec.abook.abv.bl.dto.MemberInfoDto
;
import
jp.agentec.abook.abv.bl.dto.MemberInfoDto
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.AbstractLogic
;
import
jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic
;
import
jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic
;
import
jp.agentec.abook.abv.cl.helper.AppMigrationHelper
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.cl.util.PreferenceUtil
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
import
jp.agentec.abook.abv.ui.common.appinfo.AppDefType
;
...
@@ -51,10 +52,15 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity {
...
@@ -51,10 +52,15 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity {
setContentView
(
R
.
layout
.
ac_splash1
);
setContentView
(
R
.
layout
.
ac_splash1
);
getABVUIDataCache
().
isFirstLaunching
=
true
;
getABVUIDataCache
().
isFirstLaunching
=
true
;
//app migration
AppMigrationHelper
appMigrationHelper
=
new
AppMigrationHelper
();
appMigrationHelper
.
runMigration
(
this
);
}
}
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
Logger
.
i
(
TAG
,
"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
);
if
(
chekcFlg
)
{
if
(
chekcFlg
)
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/ABookPermissionHelper.java
View file @
6c7935c6
...
@@ -63,15 +63,31 @@ public class ABookPermissionHelper {
...
@@ -63,15 +63,31 @@ public class ABookPermissionHelper {
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
);
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
);
}
}
// ストレージ
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
//Android13以上
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
android
.
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
);
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
READ_MEDIA_VIDEO
);
}
}
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
android
.
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
reqPermissions
.
add
(
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
);
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
);
}
}
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
)
{
...
@@ -106,21 +122,31 @@ public class ABookPermissionHelper {
...
@@ -106,21 +122,31 @@ public class ABookPermissionHelper {
int
permitionTextResourceId
=
-
1
;
int
permitionTextResourceId
=
-
1
;
switch
(
mPermitionType
)
{
switch
(
mPermitionType
)
{
case
Constant
.
ABookPermissionType
.
ReadExternalStorage
:
case
Constant
.
ABookPermissionType
.
ReadExternalStorage
:
// ストレージ
boolean
permissionGranted
=
true
;
if
(
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
||
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
//Android13以上
ContextCompat
.
checkSelfPermission
(
mContext
,
android
.
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PERMISSION_GRANTED
)
{
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
||
if
(
mContext
instanceof
HTMLWebViewActivity
||
mContext
instanceof
OperationListActivity
||
mContext
instanceof
OperationListActivity
||
mContext
instanceof
DeviceImageListActivity
)
{
mContext
instanceof
DeviceImageListActivity
)
{
// リソースパターンの適用
// リソースパターンの適用
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
;
...
...
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