So I'm trying to create a plugin for Cordova (using Ionic framework) that will correctly initialize Parse Push plugin upon app creation. The current plugin initializes this upon Activity creation. If the application is closed and we get a push notification, the application will run ParsePushBroadcastReceiver and will not create our Activity (which is where the Parse initialization plugin is ran).
Basically, the normal startup of the app is:
App opened -> Application -> Activity -> App.js -> Parse Push initialization
When notified
Push notification-> Application -> ParsePushBroadcastReceiver -> CRASH
The ideal situation would be to be able to distribute the plugin with a proper way to initialize something via Application startup, and not the regular Cordova way to initialize upon Activity startup (or javascript initialization afterwards). Is there a way to do this in a clean distributable way? Will the users of my plugin have to create their own App extension to initialize Parse? If this is true, then the code is going into the platforms/android folder. And also, by default most projects don't include the /platforms/ folder on their source, and they add it via CLI. Is there a way to circumvent the possible java source to another folder separate from /platform/?
Reference to current implementation i've found, but not scalable as a plugin. http://www.hiddentao.com/archives/2015/04/10/parse-push-notifications-for-your-android-and-ios-cordova-app/