I have an Android mobile app in which I have implemented Marketing Cloud Push SDK (https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/, version 8.0.7) and Firebase Cloud Messaging (version 23.0.1). When I try to send notifications from FCM to my app (killed), I receive all correctly on my device. When I try to send notifications with Marketing Cloud (outbound or via Journey Builder), I receive "silently" the notification in my Firebase Messaging Service class.
This is my sdk initialization class:
MarketingCloudConfig marketingCloudConfig = MarketingCloudConfig.builder() .setApplicationId("*********") .setAccessToken("*************") .setSenderId("***********") .setMarketingCloudServerUrl("*******************") .setMid("***************") .setDelayRegistrationUntilContactKeyIsSet(true) .setInboxEnabled(false) .setGeofencingEnabled(false) .setProximityEnabled(false) .setPiAnalyticsEnabled(false) .setAnalyticsEnabled(false) .setNotificationCustomizationOptions( //NotificationCustomizationOptions.create(R.drawable.ic_notification_icon) NotificationCustomizationOptions.create(new NotificationManager.NotificationBuilder() { @NonNull @Override public NotificationCompat.Builder setupNotificationBuilder(@NonNull Context context, @NonNull NotificationMessage notificationMessage) { NotificationCompat.Builder builder = NotificationManager.getDefaultNotificationBuilder( context, notificationMessage, NotificationManager.createDefaultNotificationChannel(context), R.drawable.ic_launcher ); builder.setContentIntent( NotificationManager.redirectIntentForAnalytics( context, PendingIntent.getActivity( context, new Random().nextInt(), new Intent(context, ItemListFragment.class), PendingIntent.FLAG_UPDATE_CURRENT ), notificationMessage, true ) ); return builder; } }) ).build(this.getContext().getApplicationContext()); MarketingCloudSdk.init(this.getContext(), marketingCloudConfig, initializationStatus -> { Log.d(TAG, "MarketingCloudSdk initialized: " + initializationStatus); Log.d(TAG, "MarketingCloudSdk initialized: isUsable() is " + initializationStatus.isUsable()); if(initializationStatus.status().toString().equals("COMPLETED_WITH_DEGRADED_FUNCTIONALITY")){ if (initializationStatus.locationsError()) { Log.d(TAG, "MarketingCloudSdk initialized: locationsError is true"); //Handle Google Play Services issues. if (GoogleApiAvailability.getInstance().isUserResolvableError(initializationStatus.playServicesStatus())) { // User will likely need to update GooglePlayServices through the Play Store. // Call GoogleApiAvailability.getInstance().showErrorDialogFragment(...) from Activity. Log.d(TAG, "MarketingCloudSdk initialized: update GooglePlayServices through the Play Store"); } } else if (initializationStatus.messagingPermissionError()) { // User disabled location permission. // Re-request permission and if granted enable desired messaging type Log.d(TAG, "MarketingCloudSdk initialized: User disabled location permission"); } }else if(initializationStatus.status().toString().equals("SUCCESS")){ Log.d(TAG, "MarketingCloudSdk initialized: success"); }else if(initializationStatus.status().toString().equals("FAILED")){ Log.d(TAG, "MarketingCloudSdk initialized: failed"); } }); Has anyone ever encountered this type of problem? These are all the information about my Android Studio project:
- Android Studio version: Dolphin 2021.3.1 Patch 1
- Android Grandle Plugin Version: 7.3.1
- Grandle Version: 7.4
- Target SDK Version: 32
- Min SDK Version: 21
- Firebase Messaging: 23.0.1
- Marketing Cloud Push SDK Version: 8.0.7