Commit aac77a51 authored by leichao.gao's avatar leichao.gao

提交代码

parent c350ee01
......@@ -49,7 +49,7 @@ class MyApplication : BaseApplication() {
private fun initNotificationWork() {
FCMUtil.initFirebase(this)
FCMUtil.subscribeToTopic("news")
FCMUtil.subscribeToTopic(ConfigHelper.packageName+"_push")
ActionBroadcast.initBroadcast(this)
}
......
......@@ -4,6 +4,7 @@ import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.test.easy.easycleanerjunk.utils.SPUtils;
......@@ -23,6 +24,7 @@ public class CloseNotificationReceiver extends BroadcastReceiver {
notificationId = 0;
}
notificationManager.cancel(notificationId);
}
}
......
......@@ -25,7 +25,7 @@ import java.util.Random;
public class NotificationUtil {
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
/**
......@@ -51,7 +51,7 @@ public class NotificationUtil {
PendingIntent deletePendingIntent = PendingIntent.getBroadcast(context, 0, deleteIntent, PendingIntent.FLAG_MUTABLE);
// 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)
.setContentTitle("title")
.setContentText("message")
......@@ -157,7 +157,7 @@ public class NotificationUtil {
btn = "Clean up";
} else if (actionId == ConfigBean.ID_APP_MANAGER) {
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";
} else if (actionId == ConfigBean.ID_BATTERY) {
icon = R.drawable.battery;
......@@ -169,7 +169,7 @@ public class NotificationUtil {
btn = "View";
} else if (actionId == ConfigBean.ID_WHATSAPP) {
icon = R.drawable.whatsapp_clean;
desc = "Running out of storage space on your phone? Clean up WhatsApp junk files to free up space";
desc = "Low on storage space? Clean up WhatsApp junk files to free up space";
btn = "View";
} else {
return;
......@@ -217,11 +217,11 @@ public class NotificationUtil {
}
private static final int[] NOTIFICATION_IDS = new int[]{
ConfigBean.ID_JUNK_CLEAN_PUSH,
ConfigBean.ID_LARGE_FILE_PUSH,
ConfigBean.ID_PHOTO_COMPRESS,
// ConfigBean.ID_JUNK_CLEAN_PUSH,
// ConfigBean.ID_LARGE_FILE_PUSH,
// ConfigBean.ID_PHOTO_COMPRESS,
ConfigBean.ID_APP_MANAGER,
ConfigBean.ID_SIMILAR_IMAGE,
// ConfigBean.ID_SIMILAR_IMAGE,
ConfigBean.ID_SCREENSHOT_CLEAN,
ConfigBean.ID_BATTERY,
ConfigBean.ID_WHATSAPP
......
......@@ -24,8 +24,6 @@ public class ReportUtils {
conn.getOutputStream().write(json.getBytes());
}
Log.d("okhttp", urlPath != null ? urlPath : "");
Log.d("okhttp", json);
StringBuilder result = new StringBuilder();
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
result.append("&").append(entry.getKey()).append("=").append(entry.getValue());
......@@ -39,7 +37,6 @@ public class ReportUtils {
if (conn.getResponseCode() == 200) {
String s = new BufferedReader(new InputStreamReader(conn.getInputStream())).readLine();
if (!TextUtils.isEmpty(s)) {
Log.d("okhttp", s);
} else {
s = "";
}
......@@ -49,7 +46,6 @@ public class ReportUtils {
}
} catch (Exception e) {
e.printStackTrace();
Log.d("okhttp", e.toString());
}
return "{ \"success\": false,\n \"errorMsg\": \"后台服务器开小差了!\",\n \"result\":{}}";
}
......
......@@ -104,8 +104,6 @@ class PermanentNotificationService : Service() {
builder.setContentIntent(pendingIntent) //设置PendingIntent
builder.setSmallIcon(R.drawable.easycleanjunk_noticeicon) //设置状态栏内的小图标
builder.setVisibility(NotificationCompat.VISIBILITY_PRIVATE) //设置通知公开可见
// builder.setOngoing(isOngoing) //设置持续(不消失的常驻通知)
// builder.setCategory(category) //设置类别
builder.setAutoCancel(false)
builder.setPriority(NotificationCompat.PRIORITY_MAX) //优先级为:重要通知
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment