Hello guys,
I was able to integrate Parse push notification into Cocos2d-x, so I would like share instruction with you in case someone would need this.
Would appreciate if someone can help extend it to make it working with passed URI parameters from notifications.
So there is instructions for Android in Android-studio:
(Original parse manual)
https://parse.com/apps/quickstart#parse_push/android/native/existing
-
Modify your gradle.build add as described in parse DOCS:
dependencies {
//Add this depndencies
compile ‘com.parse.bolts:bolts-android:1.+’
compile ‘com.parse:parse-android:1.+’
} -
Modify Androidmanifest file as described in DOC, don’t forget to put your application package name:
<!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. --> <category android:name="com.parse.starter" />
-
Add extra permissions as described in DOC:
-
Now there is tricky part, to work properly with Parse on Android you should create your own class and initialize parse inside(parse requiring to be initialized in Application class)
There is mine class MyApplication created under package org.cocos2dx.cpp:package org.cocos2dx.cpp; import android.app.Application; import com.parse.Parse; import com.parse.ParseInstallation; import com.parse.ParsePush; public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); try { Parse.initialize(this, "YOUR_API_KEY", "YOUR_SECRET_KEY"); ParseInstallation.getCurrentInstallation().saveInBackground();
//There I’m adding dummy channel
ParsePush.subscribeInBackground(“Giants”);
ParsePush push = new ParsePush();
} catch (Exception e) {
e.printStackTrace();
}} }
-
Now modify your Android manifest file
<aplication>
tag, I have added android:name parameter which pointing to my created class:
Done, now it should work Have a try to send from Parse GUI push notification