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
cb424a43
Commit
cb424a43
authored
Aug 30, 2024
by
Kim Jinsung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
内部バージョンアップ時、READ_EXTERNAL_STORAGE権限チェックしない
parent
111eb8b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
53 deletions
+47
-53
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVNoAuthenticatedActivity.java
+47
-53
No files found.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVNoAuthenticatedActivity.java
View file @
cb424a43
...
...
@@ -310,60 +310,54 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
return
null
;
}
};
//パーミッションチェック
ABookPermissionHelper
helper
=
new
ABookPermissionHelper
(
this
,
Constant
.
ABookPermissionType
.
ReadExternalStorage
,
resultCallback
);
if
(
helper
.
checkMultiPermissions
(
true
))
{
// showAlert
ABookAlertDialog
dialog
=
AlertDialogUtil
.
createABookAlertDialog
(
mContext
);
dialog
.
setTitle
(
R
.
string
.
app_update
);
dialog
.
setMessage
(
R
.
string
.
need_to_application_update
);
dialog
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
// バージョンアップフラグをON
PreferenceUtil
.
put
(
getApplicationContext
(),
AppDefType
.
DefPrefKey
.
APP_VERSIONUP_PROCESSING
,
true
);
// Android8以上でバックグラウンドをフォアグラウンドで処理
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Intent
serviceIntent
=
new
Intent
(
mContext
,
BackgroundDownloadService
.
class
);
startForegroundService
(
serviceIntent
);
}
else
{
// Download 開始
DownloadManager
downloadManager
=
(
DownloadManager
)
getSystemService
(
DOWNLOAD_SERVICE
);
String
currentDate
=
DateTimeUtil
.
toString
(
DateTimeUtil
.
getCurrentTimestamp
(),
DateTimeFormat
.
yyyyMMddHHmmss000_none
);
String
downloadUrl
=
AcmsApis
.
getDownloadApplicationFileUrl
(
abvEnvironment
.
acmsAddress
,
dataCache
.
getUrlPath
(),
dataCache
.
getMemberInfo
().
sid
,
currentDate
);
Logger
.
d
(
TAG
,
"downloadUrl=%s"
,
downloadUrl
);
Request
request
=
new
Request
(
Uri
.
parse
(
downloadUrl
));
request
.
setDescription
(
"ABook Plus New Version File"
);
//LANケーブル接続のタイプ(ETHERNET TYPE)がないため、セットしない
// request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI);
File
file
=
new
File
(
getExternalFilesDir
(
Environment
.
DIRECTORY_DOWNLOADS
),
ABVEnvironment
.
APK_FILE_NAME
);
Logger
.
d
(
TAG
,
"download local file=%s"
,
file
.
getAbsolutePath
());
File
[]
childs
=
file
.
getParentFile
().
listFiles
();
if
(
childs
!=
null
&&
childs
.
length
>
0
&&
childs
[
0
].
exists
())
{
childs
[
0
].
delete
();
}
request
.
setDestinationUri
(
Uri
.
fromFile
(
file
));
downloadManager
.
enqueue
(
request
);
registerReceiver
(
new
OnAppDownloadReceiver
(),
new
IntentFilter
(
DownloadManager
.
ACTION_DOWNLOAD_COMPLETE
));
}
// アプリを閉じる
saveLeaveAppTime
();
moveTaskToBack
(
true
);
}
});
dialog
.
setNegativeButton
(
R
.
string
.
cancel
,
new
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
moveToHome
();
}
});
showAlertDialog
(
dialog
);
}
else
{
Logger
.
w
(
TAG
,
"ReadExternalStorage checkMultiPermissions false"
);
}
// showAlert
ABookAlertDialog
dialog
=
AlertDialogUtil
.
createABookAlertDialog
(
mContext
);
dialog
.
setTitle
(
R
.
string
.
app_update
);
dialog
.
setMessage
(
R
.
string
.
need_to_application_update
);
dialog
.
setPositiveButton
(
R
.
string
.
ok
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
// バージョンアップフラグをON
PreferenceUtil
.
put
(
getApplicationContext
(),
AppDefType
.
DefPrefKey
.
APP_VERSIONUP_PROCESSING
,
true
);
// Android8以上でバックグラウンドをフォアグラウンドで処理
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Intent
serviceIntent
=
new
Intent
(
mContext
,
BackgroundDownloadService
.
class
);
startForegroundService
(
serviceIntent
);
}
else
{
// Download 開始
DownloadManager
downloadManager
=
(
DownloadManager
)
getSystemService
(
DOWNLOAD_SERVICE
);
String
currentDate
=
DateTimeUtil
.
toString
(
DateTimeUtil
.
getCurrentTimestamp
(),
DateTimeFormat
.
yyyyMMddHHmmss000_none
);
String
downloadUrl
=
AcmsApis
.
getDownloadApplicationFileUrl
(
abvEnvironment
.
acmsAddress
,
dataCache
.
getUrlPath
(),
dataCache
.
getMemberInfo
().
sid
,
currentDate
);
Logger
.
d
(
TAG
,
"downloadUrl=%s"
,
downloadUrl
);
Request
request
=
new
Request
(
Uri
.
parse
(
downloadUrl
));
request
.
setDescription
(
"ABook Plus New Version File"
);
//LANケーブル接続のタイプ(ETHERNET TYPE)がないため、セットしない
// request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI);
File
file
=
new
File
(
getExternalFilesDir
(
Environment
.
DIRECTORY_DOWNLOADS
),
ABVEnvironment
.
APK_FILE_NAME
);
Logger
.
d
(
TAG
,
"download local file=%s"
,
file
.
getAbsolutePath
());
File
[]
childs
=
file
.
getParentFile
().
listFiles
();
if
(
childs
!=
null
&&
childs
.
length
>
0
&&
childs
[
0
].
exists
())
{
childs
[
0
].
delete
();
}
request
.
setDestinationUri
(
Uri
.
fromFile
(
file
));
downloadManager
.
enqueue
(
request
);
registerReceiver
(
new
OnAppDownloadReceiver
(),
new
IntentFilter
(
DownloadManager
.
ACTION_DOWNLOAD_COMPLETE
));
}
// アプリを閉じる
saveLeaveAppTime
();
moveTaskToBack
(
true
);
}
});
dialog
.
setNegativeButton
(
R
.
string
.
cancel
,
new
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialog
,
int
which
)
{
moveToHome
();
}
});
showAlertDialog
(
dialog
);
}
else
{
moveToHome
();
}
...
...
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