导航菜单

页面标题

页面副标题

Vi App v10.18.0 - RNPushNotificationBootEventReceiver.java 源代码

正在查看: Vi App v10.18.0 应用的 RNPushNotificationBootEventReceiver.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.dieam.reactnativepushnotification.modules;

import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import java.util.Set;

public class RNPushNotificationBootEventReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("rn_push_notification", 0);
        Set<String> keySet = sharedPreferences.getAll().keySet();
        RNPushNotificationHelper rNPushNotificationHelper = new RNPushNotificationHelper((Application) context.getApplicationContext());
        for (String str : keySet) {
            try {
                String string = sharedPreferences.getString(str, null);
                if (string != null) {
                    RNPushNotificationAttributes fromJson = RNPushNotificationAttributes.fromJson(string);
                    if (fromJson.getFireDate() < System.currentTimeMillis()) {
                        StringBuilder sb = new StringBuilder();
                        sb.append("RNPushNotificationBootEventReceiver: Showing notification for ");
                        sb.append(fromJson.getId());
                        rNPushNotificationHelper.sendToNotificationCentre(fromJson.toBundle());
                    } else {
                        StringBuilder sb2 = new StringBuilder();
                        sb2.append("RNPushNotificationBootEventReceiver: Scheduling notification for ");
                        sb2.append(fromJson.getId());
                        rNPushNotificationHelper.sendNotificationScheduledCore(fromJson.toBundle());
                    }
                }
            } catch (Exception unused) {
                StringBuilder sb3 = new StringBuilder();
                sb3.append("Problem with boot receiver loading notification ");
                sb3.append(str);
            }
        }
    }
}