How to receive push notifications sent from Back4app backend in Android app

833 views
Skip to first unread message

Ghn Ghn

unread,
Aug 24, 2016, 3:33:22 AM8/24/16
to back{4}app
How to receive push notification sent from back4app backend in android app:

Do I have to create GCM push Receiver class?

I did following procress to receive push notification sent from back4app backend:
1. Added GCM sender Id in back4app backend
2. Added sender id android manifest file
<meta-data
android:name="com.parse.push.gcm_sender_id"
android:value="id:763300773243" />
3.Also save sender id in parse Installation table
4.Created GCM push receiver class as well.

ParseInstallation parseIns = ParseInstallation.getCurrentInstallation();
parseIns.put("GCMSenderId", "763300773243");
parseIns.save();

But not receiving any push notification in android app.

can anyone help for this?

Does anyone receiving push from sent from back4app?

Davi Macêdo

unread,
Aug 24, 2016, 3:20:56 PM8/24/16
to back{4}app
Hi.

You still need to include additional information in your manifest file. Take a look in the step 2 of this link here:

If you have any problem, let me know.

Best!

Ghn Ghn

unread,
Aug 25, 2016, 1:54:43 AM8/25/16
to back{4}app
Thanks for all your help...I have made some changes in Android manifest file. Now I received push notification on android device.

Now, I need to implement push notification using cloud code in my app.

Cloud code is not working for me..Cloud code is not executing from backend of back4app.

Ghn Ghn

unread,
Aug 25, 2016, 2:09:10 AM8/25/16
to back{4}app
But push notification from back4app backend not working for Amazon kindle device:

I get following message in log:

com.parse.ParsePushChannelsController: Tried to subscribe or unsubscribe from a channel, but push is not enabled correctly. Push is not configured for this app because the app manifest is missing required declarations. Please add the following declarations to your app manifest to use GCM for push: make sure that these permissions are declared as children of the root <manifest> element:

Davi Macêdo

unread,
Aug 25, 2016, 5:05:54 PM8/25/16
to back{4}app
Hi.

Parse Server doesn't have yet implemented push notification adapter for kindle.

About cloud code function, you can use this example here as reference:

Best.

Ghn Ghn

unread,
Aug 26, 2016, 2:25:59 AM8/26/16
to back{4}app
Need to send push notification on afterSave function.

Parse.Cloud.afterSave("tableName", function(request) {
  var query = new Parse.Query(Parse.Installation);
  query.equalTo('columnName', 'value');
  query.equalTo('columnName', request.object.get('value'));
 
    Parse.Push.send({
  where: query, // Set our Installation query
  data: {
    aps: request.object
  }
}, {
  success: function() {
    // Push was successful
console.log("Push Successful", Date.now());
  },
  error: function(error) {
    // Handle error
console.log("Push fail", Date.now());
  }
});
});

Is this function right?

This function is not executing from parse cloud code.

Getting following logs when tried to execute above function from cloud code.

Push fail 1472111494600
Push fail 1472111787029
Push fail 1472111837272
Push fail 1472113423156

can you please look into this and provide any solution for this?

Parse Server doesn't have yet implemented push notification adapter for kindle:

Receiving push notification with parse on Amazon kindle but not receiving it from back4app dashboard.

Davi Macêdo

unread,
Sep 20, 2016, 1:37:09 AM9/20/16
to back{4}app
Hi.

You should use something like this:

Parse.Push.send({

  where: query, // Set our Installation query

  data: {

    alert: 'your message goes here'

  }

}, { useMasterKey:true,

  success: function() {

    // Push was successful

console.log("Push Successful", Date.now());

  },

  error: function(error) {

    // Handle error

console.log("Push fail", Date.now());

  }

});

});


Push for kindle is not yet available.


Best.


yabd...@gmail.com

unread,
Jan 18, 2017, 12:29:09 PM1/18/17
to back{4}app
Hey, can you please tell me the changes you made as mine is still not working. I followed the guide on back4app docs, but with no luck

Davi Macêdo

unread,
Jan 19, 2017, 9:18:44 AM1/19/17
to back{4}app
Hi.

Would it be possible you pick up a time slot in the link below?

I will help you to debug it on a Skype chat.

best!
Reply all
Reply to author
Forward
0 new messages