I'm trying to implement push notifications through SF MC in my React Native project. I installed react-native-marketingcloudsdk and followed the instructions in the README and I get the following build errors:
error: cannot find symbol
MarketingCloudSdk.init(this,
^
symbol: variable MarketingCloudSdk
location: class MainApplication
<folderpath>/MainApplication.java:57: error: cannot find symbol
MarketingCloudConfig.builder()
^
symbol: variable MarketingCloudConfig
location: class MainApplication
<folderpath>/MainApplication.java:63: error: cannot find symbol
.setNotificationCustomizationOptions(NotificationCustomizationOptions.create(R.mipmap.ic_launcher_round))
^
symbol: variable NotificationCustomizationOptions
I added my SDK initialization in MainApplication.java:
@Override
public void onCreate() {
super.onCreate();
MarketingCloudSdk.init(this,
MarketingCloudConfig.builder()
.setApplicationId("******")
.setAccessToken("*****")
.setSenderId("("*****")")
.setMarketingCloudServerUrl("("*****")/")
.setMid("("*****")")
.setNotificationCustomizationOptions(NotificationCustomizationOptions.create(R.mipmap.ic_launcher_round))
.setAnalyticsEnabled(true)
.build(this),
initializationStatus -> Log.e("SF MC INIT Status", initializationStatus.toString()));
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
If I add these lines to my MainApplication.java file, I can get rid of the build errors and I can see the Marketing cloud initialization is successful:
import com.salesforce.marketingcloud.MarketingCloudConfig;
import com.salesforce.marketingcloud.MarketingCloudSdk;
import com.salesforce.marketingcloud.notifications.NotificationCustomizationOptions;
However, when I send a test notification through Marketing Cloud Mobile Push I don't receive any on Android despite the Device ID being registered on my contact. On iOS my test notifications also work fine through Mobile Push. Testing through Firebase I do receive test notifications so that side should be fine. What could be wrong with my React Native Marketing Cloud SDK implementation for Android?