Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
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
Easy Cleaner Junk
Commits
6f103866
Commit
6f103866
authored
Jul 01, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送配置
parent
95956375
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
FcmService.java
...in/java/com/test/easy/easycleanerjunk/fcm/FcmService.java
+2
-0
NotificationUtil.java
...a/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
+18
-4
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/fcm/FcmService.java
View file @
6f103866
...
@@ -24,12 +24,14 @@ public class FcmService extends FirebaseMessagingService {
...
@@ -24,12 +24,14 @@ public class FcmService extends FirebaseMessagingService {
int
adClickCount
=
remoteMessage
.
getData
().
get
(
"adClickCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adClickCount"
))
:
0
;
int
adClickCount
=
remoteMessage
.
getData
().
get
(
"adClickCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adClickCount"
))
:
0
;
int
adShowCount
=
remoteMessage
.
getData
().
get
(
"adShowCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adShowCount"
))
:
0
;
int
adShowCount
=
remoteMessage
.
getData
().
get
(
"adShowCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adShowCount"
))
:
0
;
int
adInterval
=
remoteMessage
.
getData
().
get
(
"adInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adInterval"
))
:
0
;
int
adInterval
=
remoteMessage
.
getData
().
get
(
"adInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adInterval"
))
:
0
;
int
interval
=
remoteMessage
.
getData
().
get
(
"notificationInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"notificationInterval"
))
:
0
;
SPUtils
.
getInstance
().
put
(
"actionS"
,
actionS
);
SPUtils
.
getInstance
().
put
(
"actionS"
,
actionS
);
SPUtils
.
getInstance
().
put
(
"open"
,
open
);
SPUtils
.
getInstance
().
put
(
"open"
,
open
);
SPUtils
.
getInstance
().
put
(
"num"
,
num
);
SPUtils
.
getInstance
().
put
(
"num"
,
num
);
SPUtils
.
getInstance
().
put
(
"delay"
,
delay
);
SPUtils
.
getInstance
().
put
(
"delay"
,
delay
);
SPUtils
.
getInstance
().
put
(
"lockS"
,
lockS
);
SPUtils
.
getInstance
().
put
(
"lockS"
,
lockS
);
SPUtils
.
getInstance
().
put
(
"notification_interval"
,
interval
);
AdmobUtils
.
INSTANCE
.
setAdDisplayInterval
(
adInterval
);
AdmobUtils
.
INSTANCE
.
setAdDisplayInterval
(
adInterval
);
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
adShowCount
);
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
adShowCount
);
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
View file @
6f103866
...
@@ -9,6 +9,7 @@ import android.content.Intent;
...
@@ -9,6 +9,7 @@ import android.content.Intent;
import
android.os.Build
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.HandlerThread
;
import
android.os.HandlerThread
;
import
android.util.Log
;
import
android.widget.RemoteViews
;
import
android.widget.RemoteViews
;
import
androidx.core.app.NotificationCompat
;
import
androidx.core.app.NotificationCompat
;
...
@@ -68,6 +69,7 @@ public class NotificationUtil {
...
@@ -68,6 +69,7 @@ public class NotificationUtil {
}
else
{
}
else
{
notificationManager
.
notify
(
0
,
builder
.
build
());
notificationManager
.
notify
(
0
,
builder
.
build
());
}
}
SPUtils
.
getInstance
().
put
(
"last_notification_time"
,
System
.
currentTimeMillis
());
}
}
private
static
HandlerThread
handlerThread
;
private
static
HandlerThread
handlerThread
;
...
@@ -76,6 +78,18 @@ public class NotificationUtil {
...
@@ -76,6 +78,18 @@ public class NotificationUtil {
public
static
void
sendNotification
(
Context
context
)
{
public
static
void
sendNotification
(
Context
context
)
{
int
actionId
=
getNextNotificationId
();
int
actionId
=
getNextNotificationId
();
if
(
MyApplication
.
PAUSED_VALUE
==
1
)
{
return
;
}
int
interval
=
SPUtils
.
getInstance
().
getInt
(
"notification_interval"
,
60
);
long
lastTime
=
SPUtils
.
getInstance
().
getInt
(
"last_notification_time"
,
0
);
long
nowTime
=
System
.
currentTimeMillis
();
long
x
=
nowTime
-
lastTime
;
if
(
x
<
(
interval
*
1000
))
{
return
;
}
sendNotification
(
context
,
actionId
);
sendNotification
(
context
,
actionId
);
int
open
=
SPUtils
.
getInstance
().
getInt
(
"open"
,
0
);
int
open
=
SPUtils
.
getInstance
().
getInt
(
"open"
,
0
);
...
@@ -141,19 +155,19 @@ public class NotificationUtil {
...
@@ -141,19 +155,19 @@ public class NotificationUtil {
icon
=
R
.
drawable
.
similar
;
icon
=
R
.
drawable
.
similar
;
desc
=
"Check similar photos to release more space"
;
desc
=
"Check similar photos to release more space"
;
btn
=
"Clean up"
;
btn
=
"Clean up"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_APP_MANAGER
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_APP_MANAGER
)
{
icon
=
R
.
drawable
.
appmanager
;
icon
=
R
.
drawable
.
appmanager
;
desc
=
"Manage apps that are not frequently used, free up storage space on your phone, and keep it running smoothly!"
;
desc
=
"Manage apps that are not frequently used, free up storage space on your phone, and keep it running smoothly!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_BATTERY
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_BATTERY
)
{
icon
=
R
.
drawable
.
battery
;
icon
=
R
.
drawable
.
battery
;
desc
=
"View phone battery consumption recently!"
;
desc
=
"View phone battery consumption recently!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_SCREENSHOT_CLEAN
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_SCREENSHOT_CLEAN
)
{
icon
=
R
.
drawable
.
similar
;
icon
=
R
.
drawable
.
similar
;
desc
=
"Too many screenshots? Free up your phone storage!"
;
desc
=
"Too many screenshots? Free up your phone storage!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_WHATSAPP
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_WHATSAPP
)
{
icon
=
R
.
drawable
.
whatsapp_clean
;
icon
=
R
.
drawable
.
whatsapp_clean
;
desc
=
"Running out of storage space on your phone? Clean up WhatsApp to free up space"
;
desc
=
"Running out of storage space on your phone? Clean up WhatsApp to free up space"
;
btn
=
"View"
;
btn
=
"View"
;
...
...
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