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
aac77a51
Commit
aac77a51
authored
Jul 01, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交代码
parent
c350ee01
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
15 deletions
+11
-15
MyApplication.kt
.../main/java/com/test/easy/easycleanerjunk/MyApplication.kt
+1
-1
CloseNotificationReceiver.java
...t/easy/easycleanerjunk/fcm/CloseNotificationReceiver.java
+2
-0
NotificationUtil.java
...a/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
+8
-8
ReportUtils.java
...java/com/test/easy/easycleanerjunk/helps/ReportUtils.java
+0
-4
PermanentNotificationService.kt
...y/easycleanerjunk/service/PermanentNotificationService.kt
+0
-2
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/MyApplication.kt
View file @
aac77a51
...
@@ -49,7 +49,7 @@ class MyApplication : BaseApplication() {
...
@@ -49,7 +49,7 @@ class MyApplication : BaseApplication() {
private
fun
initNotificationWork
()
{
private
fun
initNotificationWork
()
{
FCMUtil
.
initFirebase
(
this
)
FCMUtil
.
initFirebase
(
this
)
FCMUtil
.
subscribeToTopic
(
"news
"
)
FCMUtil
.
subscribeToTopic
(
ConfigHelper
.
packageName
+
"_push
"
)
ActionBroadcast
.
initBroadcast
(
this
)
ActionBroadcast
.
initBroadcast
(
this
)
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fcm/CloseNotificationReceiver.java
View file @
aac77a51
...
@@ -4,6 +4,7 @@ import android.app.NotificationManager;
...
@@ -4,6 +4,7 @@ import android.app.NotificationManager;
import
android.content.BroadcastReceiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.util.Log
;
import
com.test.easy.easycleanerjunk.utils.SPUtils
;
import
com.test.easy.easycleanerjunk.utils.SPUtils
;
...
@@ -23,6 +24,7 @@ public class CloseNotificationReceiver extends BroadcastReceiver {
...
@@ -23,6 +24,7 @@ public class CloseNotificationReceiver extends BroadcastReceiver {
notificationId
=
0
;
notificationId
=
0
;
}
}
notificationManager
.
cancel
(
notificationId
);
notificationManager
.
cancel
(
notificationId
);
}
}
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
View file @
aac77a51
...
@@ -25,7 +25,7 @@ import java.util.Random;
...
@@ -25,7 +25,7 @@ import java.util.Random;
public
class
NotificationUtil
{
public
class
NotificationUtil
{
private
static
final
String
CHANNEL_ID
=
"notification_id"
;
// 通知渠道ID
private
static
final
String
CHANNEL_ID
=
"notification_id"
;
// 通知渠道ID
private
static
final
String
CHANNEL_NAME
=
"fcm"
;
// 通知渠道名称
private
static
final
String
CHANNEL_NAME
=
"fcm
_channel
"
;
// 通知渠道名称
private
static
final
int
NOTIFICATION_ID
=
0
;
// 通知ID
private
static
final
int
NOTIFICATION_ID
=
0
;
// 通知ID
/**
/**
...
@@ -51,7 +51,7 @@ public class NotificationUtil {
...
@@ -51,7 +51,7 @@ public class NotificationUtil {
PendingIntent
deletePendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
0
,
deleteIntent
,
PendingIntent
.
FLAG_MUTABLE
);
PendingIntent
deletePendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
0
,
deleteIntent
,
PendingIntent
.
FLAG_MUTABLE
);
// Create the notification
// Create the notification
NotificationCompat
.
Builder
builder
=
new
NotificationCompat
.
Builder
(
context
,
"channel_id"
)
NotificationCompat
.
Builder
builder
=
new
NotificationCompat
.
Builder
(
context
,
CHANNEL_ID
)
.
setSmallIcon
(
R
.
drawable
.
easycleanjunk_noticeicon
)
.
setSmallIcon
(
R
.
drawable
.
easycleanjunk_noticeicon
)
.
setContentTitle
(
"title"
)
.
setContentTitle
(
"title"
)
.
setContentText
(
"message"
)
.
setContentText
(
"message"
)
...
@@ -157,7 +157,7 @@ public class NotificationUtil {
...
@@ -157,7 +157,7 @@ public class NotificationUtil {
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
=
"
Running out of space on your phone? Manage less frequently used apps to free up space on your phone
!"
;
desc
=
"
Low on storage space? Free up space on your device by managing unused apps
!"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_BATTERY
)
{
}
else
if
(
actionId
==
ConfigBean
.
ID_BATTERY
)
{
icon
=
R
.
drawable
.
battery
;
icon
=
R
.
drawable
.
battery
;
...
@@ -169,7 +169,7 @@ public class NotificationUtil {
...
@@ -169,7 +169,7 @@ public class NotificationUtil {
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 phon
e? Clean up WhatsApp junk files to free up space"
;
desc
=
"
Low on storage spac
e? Clean up WhatsApp junk files to free up space"
;
btn
=
"View"
;
btn
=
"View"
;
}
else
{
}
else
{
return
;
return
;
...
@@ -217,11 +217,11 @@ public class NotificationUtil {
...
@@ -217,11 +217,11 @@ public class NotificationUtil {
}
}
private
static
final
int
[]
NOTIFICATION_IDS
=
new
int
[]{
private
static
final
int
[]
NOTIFICATION_IDS
=
new
int
[]{
ConfigBean
.
ID_JUNK_CLEAN_PUSH
,
//
ConfigBean.ID_JUNK_CLEAN_PUSH,
ConfigBean
.
ID_LARGE_FILE_PUSH
,
//
ConfigBean.ID_LARGE_FILE_PUSH,
ConfigBean
.
ID_PHOTO_COMPRESS
,
//
ConfigBean.ID_PHOTO_COMPRESS,
ConfigBean
.
ID_APP_MANAGER
,
ConfigBean
.
ID_APP_MANAGER
,
ConfigBean
.
ID_SIMILAR_IMAGE
,
//
ConfigBean.ID_SIMILAR_IMAGE,
ConfigBean
.
ID_SCREENSHOT_CLEAN
,
ConfigBean
.
ID_SCREENSHOT_CLEAN
,
ConfigBean
.
ID_BATTERY
,
ConfigBean
.
ID_BATTERY
,
ConfigBean
.
ID_WHATSAPP
ConfigBean
.
ID_WHATSAPP
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ReportUtils.java
View file @
aac77a51
...
@@ -24,8 +24,6 @@ public class ReportUtils {
...
@@ -24,8 +24,6 @@ public class ReportUtils {
conn
.
getOutputStream
().
write
(
json
.
getBytes
());
conn
.
getOutputStream
().
write
(
json
.
getBytes
());
}
}
Log
.
d
(
"okhttp"
,
urlPath
!=
null
?
urlPath
:
""
);
Log
.
d
(
"okhttp"
,
json
);
StringBuilder
result
=
new
StringBuilder
();
StringBuilder
result
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
String
>
entry
:
paramsMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
paramsMap
.
entrySet
())
{
result
.
append
(
"&"
).
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
entry
.
getValue
());
result
.
append
(
"&"
).
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
entry
.
getValue
());
...
@@ -39,7 +37,6 @@ public class ReportUtils {
...
@@ -39,7 +37,6 @@ public class ReportUtils {
if
(
conn
.
getResponseCode
()
==
200
)
{
if
(
conn
.
getResponseCode
()
==
200
)
{
String
s
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
())).
readLine
();
String
s
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
())).
readLine
();
if
(!
TextUtils
.
isEmpty
(
s
))
{
if
(!
TextUtils
.
isEmpty
(
s
))
{
Log
.
d
(
"okhttp"
,
s
);
}
else
{
}
else
{
s
=
""
;
s
=
""
;
}
}
...
@@ -49,7 +46,6 @@ public class ReportUtils {
...
@@ -49,7 +46,6 @@ public class ReportUtils {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
Log
.
d
(
"okhttp"
,
e
.
toString
());
}
}
return
"{ \"success\": false,\n \"errorMsg\": \"后台服务器开小差了!\",\n \"result\":{}}"
;
return
"{ \"success\": false,\n \"errorMsg\": \"后台服务器开小差了!\",\n \"result\":{}}"
;
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/service/PermanentNotificationService.kt
View file @
aac77a51
...
@@ -104,8 +104,6 @@ class PermanentNotificationService : Service() {
...
@@ -104,8 +104,6 @@ class PermanentNotificationService : Service() {
builder
.
setContentIntent
(
pendingIntent
)
//设置PendingIntent
builder
.
setContentIntent
(
pendingIntent
)
//设置PendingIntent
builder
.
setSmallIcon
(
R
.
drawable
.
easycleanjunk_noticeicon
)
//设置状态栏内的小图标
builder
.
setSmallIcon
(
R
.
drawable
.
easycleanjunk_noticeicon
)
//设置状态栏内的小图标
builder
.
setVisibility
(
NotificationCompat
.
VISIBILITY_PRIVATE
)
//设置通知公开可见
builder
.
setVisibility
(
NotificationCompat
.
VISIBILITY_PRIVATE
)
//设置通知公开可见
// builder.setOngoing(isOngoing) //设置持续(不消失的常驻通知)
// builder.setCategory(category) //设置类别
builder
.
setAutoCancel
(
false
)
builder
.
setAutoCancel
(
false
)
builder
.
setPriority
(
NotificationCompat
.
PRIORITY_MAX
)
//优先级为:重要通知
builder
.
setPriority
(
NotificationCompat
.
PRIORITY_MAX
)
//优先级为:重要通知
...
...
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