Files
Xuewang365OSNeutral/app/src/main/java/com/uiui/zyos/push/PushManager.java
Fanhuitong cd4ba088fc version:1.1
fix:
update:增加推送
2023-02-11 20:41:36 +08:00

61 lines
1.7 KiB
Java

package com.uiui.zyos.push;
import android.annotation.SuppressLint;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import com.uiui.zyos.disklrucache.CacheHelper;
import com.uiui.zyos.utils.ToastUtil;
public class PushManager {
private static final String TAG = PushManager.class.getSimpleName();
public static final String SET_ALARMCLOCK = "zuoyeos.action.change.alarmclaock";
@SuppressLint("StaticFieldLeak")
private static PushManager sInstance;
private Context mContext;
private ContentResolver mResolver;
private CacheHelper mCacheHelper;
private PushManager(Context context) {
if (context == null) {
throw new RuntimeException("Context is NULL");
}
this.mContext = context;
this.mResolver = context.getContentResolver();
this.mCacheHelper = new CacheHelper(context);
}
public static void init(Context context) {
if (sInstance == null) {
sInstance = new PushManager(context);
}
}
public static PushManager getInstance() {
if (sInstance == null) {
throw new IllegalStateException("You must be init PushManager first");
}
return sInstance;
}
//闹钟
private static final String JIGUANG_ALARM_CLOCK = "57";
public void setPushContent(String title, String extras) {
switch (title) {
case JIGUANG_ALARM_CLOCK:
ToastUtil.betaShow("收到推送消息: 设置闹钟");
Intent intent = new Intent(SET_ALARMCLOCK);
mContext.sendBroadcast(intent);
break;
default:
}
}
}