android - Push Notification through local parse-server and parse dash board -
hi able run parse-server , parse dashboard in local system.i trying connect android app parse -server in same system.i not hosting parse-server heroku or other hosting site.i able get/send message comandline using command
curl -x post \ -h "x-parse-application-id:<app_id>" \ -h "content-type: application/json" \ -d '{"name":"<name>","score":<score>}' \ http://localhost:1337/parse/classes/player
but not able connect parse-server android app.
mongodb,parse-server-example , parse-dashboard working.my android code : manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.parse.pushnotification" > <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <permission android:name="<my_package>.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="<my_package>.permission.c2d_message" /> <application android:name=".pushparseservertest" android:allowbackup="true" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name=".mainactivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <meta-data android:name="com.parse.push.gcm_sender_id" android:value="id:<gcm_project_id>" /> <service android:name="com.parse.pushservice" /> <receiver android:name="com.parse.gcmbroadcastreceiver" android:permission="com.google.android.c2dm.permission.send" > <intent-filter> <action android:name="com.google.android.c2dm.intent.receive" /> <action android:name="com.google.android.c2dm.intent.registration" /> <category android:name="<my_package_name>" /> </intent-filter> </receiver> <receiver android:name="<my_package>.parsepushnotificationreceiver" android:exported="false" > <intent-filter> <action android:name="android.intent.action.boot_completed" /> <action android:name="android.intent.action.user_present" /> <action android:name="com.parse.push.intent.receive" /> <action android:name="com.parse.push.intent.delete" /> <action android:name="com.parse.push.intent.open" /> <category android:name="<my_package_name>" /> </intent-filter> </receiver> </application> </manifest>
build.gradle file
{ compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.parse.bolts:bolts-tasks:1.3.0' compile 'com.parse:parse-android:1.13.0' }
pushparseservertest.java
public class starterapplication extends application { @override public void oncreate() { super.oncreate(); // enable local datastore. parse.enablelocaldatastore(this); // add initialization code here //parse.initialize(this); parse.initialize(new parse.configuration.builder(getapplicationcontext()) .applicationid("@string/parse_app_id") .clientkey("@string/parse_client_key") .server("http://<my_system_ip>:1337/parse/") // '/' important after 'parse' .build()); } }
parsepushnotificationreceiver.java
public class parsepushnotificationreceiver extends broadcastreceiver { private static final string tag = "parsepushnotificationreceiver"; // public static final string intentaction = "com.parse.push.intent.receive"; @override public void onreceive(context context, intent intent) { if (intent == null) { log.d(tag, "receiver intent null"); } else { // parse push message , handle accordingly log.d(tag, intent.getextras().tostring()); } } }
is issue push notifications or saving objects parse-server?
did configure push notifications correctly on parse-server , register android devices correctly?
Comments
Post a Comment