Has anyone used the Mobile SDK with Capacitor?

All we need is an easy explanation of the problem, so here it is.

The Salesforce Mobile SDK has a cordova plugin. The Capacitor platform supports most but not all Cordova plugins (see known incompatability list). Does anyone know if the Salesforce mobile sdk cordova app works with Capacitor?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Capacitor is not a platform we officially support, but I do know that customers are using it and we have not heard about any large blocking issues. Our upkeep of Cordova is minimal at this point but we do not have any plans to adopt Capacitor at this time.

Method 2

UPDATE: after forking the plugin and making changes I have everything built and compiling. The app is registering in MC yet no client info is received nor do push notifications arrive in ios or in android. So my answer still stands: No it is not compatible out of the box.

I have been at it for over 2 days straight and I can not get my capacitor android app to compile with the MC-Cordova-Plugin. I have had to battle a lot of issues to get to a point where nothing seems to fix the latest error:

Parsing json file: xxxxx/android/capacitor-cordova-android-plugins/google-services.json

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':capacitor-cordova-android-plugins:processDebugGoogleServices'.
> No matching client found for package name ''

While the package name in google-services.json is certainly not an empty string.

So unless you hear otherwise on here I would assume it is not compatible. At the very least not out of the box

Method 3

We tried to use the SDK using the Capacitor, but it did not work properly. The notification is not received by the SDK, apparently the Capacitor receives it.

As the capacitor has a native push notification mechanism at its core, I suppose that the solution must pass through the receipt of the notification by the capacitor, which should call the MC SDK.

Thus, we are unable to use the features provided by the SDK. Probably, the best solution would be a rewritten plugin for Capacitor.

I suggested creating a new Capacitor plugin on the "Capacitor Community" forum on Github. If you want to vote on this suggestion, the link is this:


Method 4

Using Capacitor 3.0.0-beta, it’s work well with Android and I received the push notification with success.

But at iOS it’s not working yet and I’m testing and debugging to understand what the problem is.

Has anyone successfully managed notifications with capacitor 3.0 on iOS?

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply