Commit d07118da by Kim Jinsung

AndroidOSバージョンアップ時、権限チェック処理追加

アプリバージョンアップ時、権限チェック処理追加
parent 7fd6a7c4
......@@ -71,7 +71,16 @@ public abstract class ABVSplashActivity extends ABVNoAuthenticatedActivity {
REQUEST_PERMISSIONS);
}
} else {
//Androidバージョンアップ時追加された権限チェックを追加
ABookPermissionHelper helper = new ABookPermissionHelper(this);
mPermissionArray = helper.checkAndroidVersionUpPermissions();
if (mPermissionArray.size() == 0) {
abookMode();
} else {
ActivityCompat.requestPermissions(this,
mPermissionArray.toArray(new String[mPermissionArray.size()]),
REQUEST_PERMISSIONS);
}
}
}
......
......@@ -86,6 +86,10 @@ public interface AppDefType {
String CHAT_LAST_ROOMNAME = "chatLastRoom"; // 最後のルーム名
String CHAT_LAST_ROOMID = "chatLastRoomId"; // 最後のルームID
//Android13から追加した権限追加
String ANDROID_13_NOTIFICATION_PERMISSION_CHECK = "android13NotificationPermissionCheck";
String ANDROID_13_IMAGE_VIDEO_CHECK_PERMISSION_CHECK = "android13ImageVideoPermissionCheck";
}
interface SubMenuType {
......
......@@ -15,6 +15,7 @@ import java.util.ArrayList;
import jp.agentec.abook.abv.bl.common.Callback;
import jp.agentec.abook.abv.bl.common.Constant;
import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.cl.util.PreferenceUtil;
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.util.AlertDialogUtil;
......@@ -47,6 +48,38 @@ public class ABookPermissionHelper {
mContext = context;
}
/**
* AndroidOSバージョンアップ時の追加権限チェック
* @return 権限文字列の配列
*/
public ArrayList<String> checkAndroidVersionUpPermissions() {
ArrayList<String> reqPermissions = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { //Android13以上
boolean chekcImageVideoFlg = PreferenceUtil.getUserPref(mContext, AppDefType.UserPrefKey.ANDROID_13_IMAGE_VIDEO_CHECK_PERMISSION_CHECK, true);
if (chekcImageVideoFlg) {
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);
}
PreferenceUtil.putUserPref(mContext, AppDefType.UserPrefKey.ANDROID_13_IMAGE_VIDEO_CHECK_PERMISSION_CHECK, false);
}
boolean chekcNotificationFlg = PreferenceUtil.getUserPref(mContext, AppDefType.UserPrefKey.ANDROID_13_NOTIFICATION_PERMISSION_CHECK, true);
if (chekcNotificationFlg){
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_NOTIFICATION_PERMISSION_CHECK, false);
}
}
return reqPermissions;
}
public ArrayList<String> checkMultiPermissions() {
ArrayList<String> reqPermissions = new ArrayList<>();
......@@ -67,15 +100,19 @@ public class ABookPermissionHelper {
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.READ_MEDIA_VIDEO) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.READ_MEDIA_VIDEO);
PreferenceUtil.putUserPref(mContext, AppDefType.UserPrefKey.ANDROID_13_IMAGE_VIDEO_CHECK_PERMISSION_CHECK, false);
}
if (ContextCompat.checkSelfPermission(mContext,
android.Manifest.permission.READ_MEDIA_IMAGES) != PackageManager.PERMISSION_GRANTED) {
reqPermissions.add(android.Manifest.permission.READ_MEDIA_IMAGES);
PreferenceUtil.putUserPref(mContext, AppDefType.UserPrefKey.ANDROID_13_IMAGE_VIDEO_CHECK_PERMISSION_CHECK, false);
}
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_NOTIFICATION_PERMISSION_CHECK, false);
}
} else {
// ストレージ
if (ContextCompat.checkSelfPermission(mContext,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment