mParticle in Ionic Native app


#1

I’m looking to integrate mParticle with our Ionic Native app & have been directed to https://github.com/mParticle/cordova-plugin-mparticle

Part of the plugin’s startup must be called in Android’s Application onCreate:
MParticle.start(this);

iOS has a similar requirement.

How does one add this in Ionic Native without direct access to Java (or Obj-C/Swift in iOS) code?


#2

If you have to change stuff in the platform files manually, it’s not a very good plugin.

Look at other plugins to find examples of how to do this. I think Analytics plugins are good examples as they also tend to be started with the application.


#3

@Sujan12 Thanks for the reply! That’s kind of what I feared.

Is the correct approach here (Until mParticle supports this themselves) to create a new plugin that calls the required native code?


#4

That would be the best solution - forking the plugin you linked to and make it do these things the right way.

The more practical solution is probably just do it “the dirty way” and be aware that your changes in /platform can be lost or overwritten quite easily. (I just create a git repositor in there and commit to a remote repo for safe keeping)


#5

@Sujan12 Perfect, thanks again for your quick responses!