0

I'm trying to integrate salesforce-marketingcloud Cordova plugin with an existing hybrid mobile application.

I've created firebase account and all required details for android and ios and did all the required setup for Android platform.

Next, I've installed salesforce-marketingcloud Cordova plugin into my application and started application on both ios and android phones.

I was able to see contact created for ios phone but not android, also if I add any api calls to the code eg. MCCordovaPlugin.isPushEnabled(successCallback, errorCallback);

I never get any response from the Android application but ios works.

So more info

Cordova version 7.0.0 Android version 6.3.0

When I look at the Android studio logs I don't see any errors... I can see API been called just nothing ever returns.

Any idea what could be the issue or how I could troubleshoot this?

Regards.

  • What version of the plugin are you using? Also, please enable logging and provide the output. – Bill Mote Feb 27 '18 at 13:41
2

The issue I've encountered is post_prepare hook not firing which means com.salesforce.marketingcloud.cordovaplugin.MCCordovaPluginApplication never inserted into AndroidManifest. The workaround is to insert it manually into your AndroidManifest until the plugin is fixed.

!!!Note this plugin assumes that there is no other plugin overwrites android:name property inside AndroidManifest . the following link describes how to get around the issue multiple applications

-1
  1. Have you verified the correct values present in your MCCordovaPluginApplication.java file and are set in method

MarketingCloudSdk.init(this, MarketingCloudConfig.builder()

  1. Are you using Cordova platform development using Android Studio? If so have you tracked if your getting all of your correct init values logged in Logcat? You can try to set your logging and make sure you are getting "MarketingCloudSdk init finished with status:" along with other info.

MarketingCloudSdk.setLogLevel(MCLogListener.VERBOSE);

MarketingCloudSdk.setLogListener(new AndroidLogListener());

  • Thank you for you suggestion I will try increasing logging level... – Serge Tk Feb 14 '18 at 19:59
  • Also yes I'm using Android Studio and I do have errors with missing R.class but I can get around it by adding import package.name.R; and it fixes that issue and I'm able to build and run the application. – Serge Tk Feb 14 '18 at 21:10
  • I've put breakpoints into MCCordovaPlugingApplication.java and none of them got hit. I've also put breakpoints into MCCordovaPlugin.java and I hit my breakpoint..... It looks like onCreate() inside MCCordovaPluginApplication.java never called. – Serge Tk Feb 14 '18 at 23:51
  • ok... yes that error with "missing R.class" is often because there are no inserted values which makes sense if you're not even executing code MCCordovaPluginApplication.java file. So a couple things. 1. I'm going to assume your add plugin command is running successfully, or there would be issues with the iOS platform as well. So when you run the gradle sync in Android Studio what happens? 2. If you get no errors can you verify the package path looks good and agrees with dir structure? package com.salesforce.marketingcloud.cordovaplugin; – Tom Brooks Feb 15 '18 at 1:34
  • Are you running this on an emulator and if so which device type and API? – Tom Brooks Feb 15 '18 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.