Commit 6f103866 authored by leichao.gao's avatar leichao.gao

推送配置

parent 95956375
......@@ -24,12 +24,14 @@ public class FcmService extends FirebaseMessagingService {
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 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("open",open);
SPUtils.getInstance().put("num",num);
SPUtils.getInstance().put("delay",delay);
SPUtils.getInstance().put("lockS",lockS);
SPUtils.getInstance().put("notification_interval",interval);
AdmobUtils.INSTANCE.setAdDisplayInterval(adInterval);
AdDisplayUtils.getInstance().setMaxAdDisplayCount(adShowCount);
......
......@@ -9,6 +9,7 @@ import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import android.widget.RemoteViews;
import androidx.core.app.NotificationCompat;
......@@ -68,6 +69,7 @@ public class NotificationUtil {
} else {
notificationManager.notify(0, builder.build());
}
SPUtils.getInstance().put("last_notification_time", System.currentTimeMillis());
}
private static HandlerThread handlerThread;
......@@ -76,6 +78,18 @@ public class NotificationUtil {
public static void sendNotification(Context context) {
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);
int open = SPUtils.getInstance().getInt("open", 0);
......@@ -141,19 +155,19 @@ public class NotificationUtil {
icon = R.drawable.similar;
desc = "Check similar photos to release more space";
btn = "Clean up";
} else if(actionId ==ConfigBean.ID_APP_MANAGER){
} else if (actionId == ConfigBean.ID_APP_MANAGER) {
icon = R.drawable.appmanager;
desc = "Manage apps that are not frequently used, free up storage space on your phone, and keep it running smoothly!";
btn = "View";
} else if(actionId ==ConfigBean.ID_BATTERY){
} else if (actionId == ConfigBean.ID_BATTERY) {
icon = R.drawable.battery;
desc = "View phone battery consumption recently!";
btn = "View";
} else if(actionId == ConfigBean.ID_SCREENSHOT_CLEAN){
} else if (actionId == ConfigBean.ID_SCREENSHOT_CLEAN) {
icon = R.drawable.similar;
desc = "Too many screenshots? Free up your phone storage!";
btn = "View";
} else if(actionId == ConfigBean.ID_WHATSAPP){
} else if (actionId == ConfigBean.ID_WHATSAPP) {
icon = R.drawable.whatsapp_clean;
desc = "Running out of storage space on your phone? Clean up WhatsApp to free up space";
btn = "View";
......
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