导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - StorylyNotificationReceiver.java 源代码

正在查看: BetterTogether v3.0.0 应用的 StorylyNotificationReceiver.java JAVA 源代码文件

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


package com.appsamurai.storyly.util.notification;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import kotlin.Metadata;

@Metadata
public final class StorylyNotificationReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Intent launchIntentForPackage;
        if (intent == null) {
            return;
        }
        Object systemService = context == null ? null : context.getSystemService("notification");
        NotificationManager notificationManager = systemService instanceof NotificationManager ? (NotificationManager) systemService : null;
        if (notificationManager == null || (launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName())) == null) {
            return;
        }
        launchIntentForPackage.setPackage(context.getPackageName());
        launchIntentForPackage.setAction("com.appsamurai.storyly.ACTION_COUNTDOWN_NOTIFICATION");
        Bundle extras = intent.getExtras();
        launchIntentForPackage.putExtra("storyly-notification-outlink", extras == null ? null : extras.getString("storyly-notification-outlink"));
        launchIntentForPackage.setFlags(launchIntentForPackage.getFlags() | 32);
        Parcelable parcelableExtra = intent.getParcelableExtra("notification");
        Notification notification = parcelableExtra instanceof Notification ? (Notification) parcelableExtra : null;
        if (notification == null) {
            return;
        }
        notification.contentIntent = PendingIntent.getActivity(context, intent.getIntExtra("storyly-notification-id", 0), launchIntentForPackage, 201326592);
        notificationManager.createNotificationChannel(new NotificationChannel("storyly-notification-channel-id", "storyly-notification-channel-name", 4));
        notificationManager.notify(intent.getIntExtra("storyly-notification-id", 0), notification);
    }
}