- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to implement Parse Plugin for using Push Notification Services. Please advise me how to implement the below procedure for an Android App in Intel XDK. I tried creating a dummy plugin with an MainApplication Class and also adding the <application> tag in plugin.xml for getting included in AndroidManifest.xml, but it is not working.
https://github.com/taivo/parse-push-plugin
------------------------------------
Android Setup:
Phonegap/Cordova doesn't define a custom android.app.Application
, it only defines an android Activity
. With anActivity
alone, we should be able to receive PNs just fine while our app is running. However, if a PN arrives when the app is not running, the app will be automatically invoked, and this plugin's ParsePushPluginReceiver
runs before the Activity
class or any javascript code gets a chance to call Parse.initialize()
. The result is a crash dialog. To fix this, do the following:
-
Define a custom Application class that calls
Parse.initialize()
in itsonCreate
method. This way, the Parse subsystem gets initialized before the PN-handling code runs. Crash avoided. In your application's Java source path, e.g.,platforms/android/src/com/example/app
, create a file named MainApplication.java and define it this waypackage com.example.app; //REPLACE THIS WITH YOUR package name import android.app.Application; import com.parse.Parse; import com.parse.ParseInstallation; public class MainApplication extends Application { @Override public void onCreate() { super.onCreate(); Parse.initialize(this, "YOUR_PARSE_APPID", "YOUR_PARSE_CLIENT_KEY"); ParseInstallation.getCurrentInstallation().saveInBackground(); } }
-
Now register MainApplication in AndroidManifest.xml so it's used instead of the default. In the
<application>
tag, add the attributeandroid:name="MainApplication"
. Obviously, you don't have to name your application class this way, but you have to use the same name in 1 and 2.
------------------------------------
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Our support staff is not able to provide help with writing plugins. Your best bet for this sort of help would be to use the Cordova threads on StackOverflow.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page