I am trying to integrate react-native-moengage based push notifications to my React Native app and it is showing me Push Token Not Generated error.
Here is my code, where I am initialising the SDK:
public class MainApplication extends Application implements ReactApplication, PushManager.OnTokenReceivedListener {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MoEReactPackage(),
new SplashScreenReactPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
MoEHelper.getInstance(getApplicationContext()).setExistingUser(false);
MoEHelper.getInstance(getApplicationContext()).autoIntegrate(this);
PushManager.getInstance().setTokenObserver(this);
MoEngage moEngage =
new MoEngage.Builder(this, "XXX")
.setSenderId("XXX")
.setLogLevel(Logger.VERBOSE)
.build();
MoEngage.initialise(moEngage);
SoLoader.init(this, /* native exopackage */ false);
}
@Override
public void onTokenReceived(String token) {
Toast.makeText(this, token, Toast.LENGTH_LONG);
}
}
I am trying to implement it just for android for the time being, so I need help with just that here. Please help if someone has figured out a way.