我是 Android 开发新手。我有应用程序内结算功能,可以让人们购买推送通知。
当我实现 Firebase 消息传递时。它开箱即用。惊人的!
但。如果没有购买,我现在想禁用它。(在共享首选项中存储布尔值)
我不知道如何处理这个问题。
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = "FCM Service";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// TODO: Handle FCM messages here.
// If the application is in the foreground handle both data and notification messages here.
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated.
Log.d(TAG, "From: " + remoteMessage.getFrom()); …Run Code Online (Sandbox Code Playgroud)