parse.com - Parse server configuration with android app -
i set local parse server on machine following github instructions on parse server example repo. server , running have included parse.initialise function in main activity.java file (see screenshot)[mainactivity.java][1] question 1: app_id env variable in parse. initialise corresponds app id set in index.js file of parse server example question2: if configuration correct why app not storing data object on server.?how check if app has established contact server.android builds shows no errors. parse dashboard shows no change in data i.e. data not being stored on parse server app.my ultimate goal send push notification server. have configured app gcm, got , configured app , server correct gcm project no. (sender id) , api key. please tell doing wrong? or needs done server , app configured.
androidmanifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.hal_kumar.testapp"> <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <service android:name="com.parse.pushservice" /> <receiver android:name="com.parse.parsepushbroadcastreceiver" android:exported="false"> <intent-filter> <action android:name="com.parse.push.intent.receive" /> <action android:name="com.parse.push.intent.delete" /> <action android:name="com.parse.push.intent.open" /> </intent-filter> </receiver> <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="com.example.hal_kumar.testapp" /> </intent-filter> </receiver> <meta-data android:name="com.parse.push.gcm_sender_id" android:value="id:5xxxxxxxxxx6" />;<!--gcm project no --> </application> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.vibrate" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <!-- get_accounts required gcm on devices running android lower 4.0.4. may leave out permission if targetting 4.0.4+. --> <uses-permission android:name="android.permission.get_accounts" /> <!-- important: change "com.parse.starter.permission.c2d_message" in lines below match app's package name + ".permission.c2d_message". --> <permission android:protectionlevel="signature" android:name="com.example.hal_kumar.testapp.permission.c2d_message" /> <uses-permission android:name="com.example.hal_kumar.testapp.permission.c2d_message" /> </manifest>
index.js (parse server)
var api = new parseserver({ databaseuri: databaseuri || 'mongodb://localhost:27017/dev', cloud: process.env.cloud_code_main || __dirname + '/cloud/main.js', appid: 'xxxx', masterkey: process.env.master_key || 'xxxxx', //add master key here. keep secret! serverurl: process.env.server_url || 'http://localhost:1337/parse', // don't forget change https if needed push:{ android: { senderid: '58xxxxxxxxxx26', apikey: 'aixxxxxxo4' } } }); [1]: http://i.stack.imgur.com/nnrwn.png
the possible reason problem can of internet permission.try build project placing permission code before begin of code application in manifest.
moreover,i recommend use firebase instead of parse since parse going dead in 2017.
Comments
Post a Comment