导航菜单

页面标题

页面副标题

TruCred v1.1.3 - MyFirebaseService.java 源代码

正在查看: TruCred v1.1.3 应用的 MyFirebaseService.java JAVA 源代码文件

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


package com.veloz.app.service;

import android.util.Log;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.Util;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;

public class MyFirebaseService extends FirebaseMessagingService {
    @Override
    public void onCreate() {
        super.onCreate();
        FirebaseMessaging.getInstance().getToken().addOnCompleteListener(new OnCompleteListener<String>() {
            @Override
            public void onComplete(Task<String> task) {
                if (!task.isSuccessful() || task.getResult() == null) {
                    return;
                }
                Adjust.setPushToken(task.getResult(), MyFirebaseService.this.getBaseContext());
            }
        });
    }

    @Override
    public void onDeletedMessages() {
        super.onDeletedMessages();
    }

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        Log.d("MyFirebaseService", "From: " + remoteMessage.getFrom());
        if (remoteMessage.getData() != null) {
            Util.isAdjustUninstallDetectionPayload(remoteMessage.getData());
        }
        remoteMessage.getNotification();
    }

    @Override
    public void onNewToken(String str) {
        super.onNewToken(str);
        Adjust.setPushToken(str, getBaseContext());
    }
}