Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
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
Data Recovery White
Commits
5b896ade
Commit
5b896ade
authored
Jul 12, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...开锁屏通知
parent
3de00392
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
7 deletions
+60
-7
MyApplication.kt
app/src/main/java/com/base/datarecovery/MyApplication.kt
+8
-6
ActionBroadcast.java
.../main/java/com/base/datarecovery/fcm/ActionBroadcast.java
+51
-0
NotificationUtil.kt
...c/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
+1
-1
No files found.
app/src/main/java/com/base/datarecovery/MyApplication.kt
View file @
5b896ade
...
...
@@ -7,6 +7,7 @@ import android.os.Bundle
import
com.base.datarecovery.activity.SplashActivity
import
com.base.datarecovery.ads.AdmobOpenUtils
import
com.base.datarecovery.bean.ConstObject.ifAgreePrivacy
import
com.base.datarecovery.fcm.ActionBroadcast
import
com.base.datarecovery.fcm.FCMManager
import
com.base.datarecovery.fcm.RecoveryTimerManager
import
com.base.datarecovery.help.BaseApplication
...
...
@@ -32,18 +33,19 @@ class MyApplication : BaseApplication() {
fun
initApp
()
{
FCMManager
.
initFirebase
(
this
)
FCMManager
.
subscribeToTopic
(
packageName
+
"_push"
)
FCMManager
.
subscribeToTopic
(
packageName
+
"_push"
)
NewComUtils
.
requestCfg
{
val
timerStatus
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerS"
,
"1"
).
toIntOrNull
()
?:
1
ActionBroadcast
.
initBroadcast
(
this
)
val
timerStatus
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerS"
,
"1"
).
toIntOrNull
()
?:
1
if
(
timerStatus
==
0
)
{
RecoveryTimerManager
.
getInstance
().
stopTaskTimer
()
}
else
{
val
timerDelay
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerDelay"
,
"1"
).
toIntOrNull
()
?:
1
val
timerInterval
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerInterval"
,
"7"
).
toIntOrNull
()
?:
7
val
timerDelay
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerDelay"
,
"1"
).
toIntOrNull
()
?:
1
val
timerInterval
:
Int
=
AppPreferences
.
getInstance
().
getString
(
"timerInterval"
,
"7"
).
toIntOrNull
()
?:
7
if
(!
RecoveryTimerManager
.
getInstance
().
isTaskTimerActive
)
{
RecoveryTimerManager
.
getInstance
().
scheduleTask
(
(
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
()
(
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
()
)
}
}
...
...
app/src/main/java/com/base/datarecovery/fcm/ActionBroadcast.java
0 → 100644
View file @
5b896ade
package
com
.
base
.
datarecovery
.
fcm
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.os.Build
;
import
com.base.datarecovery.help.BaseApplication
;
import
com.base.datarecovery.utils.AppPreferences
;
public
class
ActionBroadcast
extends
BroadcastReceiver
{
public
static
boolean
mIsScreenOn
=
true
;
public
static
boolean
isLock
=
false
;
public
static
void
initBroadcast
(
Context
context
)
{
IntentFilter
filter
=
new
IntentFilter
();
filter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
);
filter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
);
filter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
context
.
registerReceiver
(
new
ActionBroadcast
(),
filter
,
Context
.
RECEIVER_EXPORTED
);
}
else
{
context
.
registerReceiver
(
new
ActionBroadcast
(),
filter
);
}
}
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
switch
(
action
)
{
case
Intent
.
ACTION_SCREEN_ON
:
mIsScreenOn
=
true
;
break
;
case
Intent
.
ACTION_SCREEN_OFF
:
mIsScreenOn
=
false
;
isLock
=
true
;
break
;
case
Intent
.
ACTION_USER_PRESENT
:
isLock
=
false
;
if
(
mIsScreenOn
&&
!
isLock
)
{
int
locks
=
AppPreferences
.
getInstance
().
getInt
(
"lockS"
,
1
);
if
(
locks
==
1
)
{
NotificationUtil
.
INSTANCE
.
sendNotification
(
BaseApplication
.
context
);
}
}
break
;
}
}
}
app/src/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
View file @
5b896ade
...
...
@@ -228,7 +228,7 @@ object NotificationUtil {
handler
?.
removeCallbacksAndMessages
(
null
)
return
@Runnable
}
if
(
MyApplication
.
PAUSED_VALUE
!==
1
)
{
if
(
MyApplication
.
PAUSED_VALUE
!==
1
&&
ActionBroadcast
.
mIsScreenOn
&&
!
ActionBroadcast
.
isLock
)
{
sendNotification
(
context
,
actionId
)
}
},
time
)
...
...
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