Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
Scan QR Code Barcode Reader
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Scan QR Code Barcode Reader
Commits
30f24aff
Commit
30f24aff
authored
Jan 03, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
a8a18e72
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
28 deletions
+33
-28
MyApplication.kt
app/src/main/java/com/base/scanqr/MyApplication.kt
+18
-18
StayJobService.kt
app/src/main/java/com/base/scanqr/service/StayJobService.kt
+15
-10
No files found.
app/src/main/java/com/base/scanqr/MyApplication.kt
View file @
30f24aff
...
...
@@ -253,30 +253,30 @@ class MyApplication : Application() {
private
fun
initConfig
(
config
:
String
)
{
//
kotlin.runCatching {
val
configBean
=
Gson
().
fromJson
(
config
,
ConfigBean
::
class
.
java
)
kotlin
.
runCatching
{
val
configBean
=
Gson
().
fromJson
(
config
,
ConfigBean
::
class
.
java
)
writeLogFile
(
"config"
,
config
)
writeLogFile
(
"config"
,
config
)
val
jsonObject
=
JSONObject
()
jsonObject
.
put
(
"ut"
,
configBean
.
ut
)
EventUtils
.
event
(
"user_type"
,
ext
=
jsonObject
)
LogEx
.
logDebug
(
"initConfig"
,
"ut=${configBean.ut}"
)
val
jsonObject
=
JSONObject
()
jsonObject
.
put
(
"ut"
,
configBean
.
ut
)
EventUtils
.
event
(
"user_type"
,
ext
=
jsonObject
)
LogEx
.
logDebug
(
"initConfig"
,
"ut=${configBean.ut}"
)
//配置
ConfigBean
.
configBean
=
configBean
//配置
ConfigBean
.
configBean
=
configBean
//广告
AdConfigBean
.
adsConfigBean
=
configBean
.
adConfigBean
LogEx
.
logDebug
(
"initConfig"
,
"adsConfigBean=${AdConfigBean.adsConfigBean.timeInterval}"
)
//广告
AdConfigBean
.
adsConfigBean
=
configBean
.
adConfigBean
LogEx
.
logDebug
(
"initConfig"
,
"adsConfigBean=${AdConfigBean.adsConfigBean.timeInterval}"
)
//通知
PopupConfigBean
.
popupConfigBean
=
configBean
.
popupConfigBean
LogEx
.
logDebug
(
"initConfig"
,
"popupConfigBean=${PopupConfigBean.popupConfigBean.popupCount}"
)
//通知
PopupConfigBean
.
popupConfigBean
=
configBean
.
popupConfigBean
LogEx
.
logDebug
(
"initConfig"
,
"popupConfigBean=${PopupConfigBean.popupConfigBean.popupCount}"
)
//启动定时器
changeTimer
()
//
}
//启动定时器
changeTimer
()
}
}
...
...
app/src/main/java/com/base/scanqr/service/StayJobService.kt
View file @
30f24aff
...
...
@@ -13,6 +13,7 @@ import android.os.Build
import
android.os.CountDownTimer
import
androidx.work.Configuration
import
com.base.scanqr.BuildConfig
import
com.base.scanqr.helper.EventUtils
import
com.base.scanqr.service.StayNotification.createPermanentNotification
import
com.base.scanqr.utils.LogEx
...
...
@@ -53,17 +54,21 @@ class StayJobService : JobService() {
}
private
fun
startForeground
()
{
val
notification
=
createPermanentNotification
(
applicationContext
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
startForeground
(
NOTIFICATION_STAY_ID
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
}
else
{
startForeground
(
NOTIFICATION_STAY_ID
,
notification
)
try
{
val
notification
=
createPermanentNotification
(
applicationContext
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
startForeground
(
NOTIFICATION_STAY_ID
,
notification
,
ServiceInfo
.
FOREGROUND_SERVICE_TYPE_DATA_SYNC
)
}
else
{
startForeground
(
NOTIFICATION_STAY_ID
,
notification
)
}
isRunning
=
true
}
catch
(
e
:
Exception
)
{
EventUtils
.
event
(
"start_foreground_service_error"
)
}
isRunning
=
true
}
private
fun
notifyForeground
()
{
...
...
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