Start a new topic

push and receive notification

Hello,

I am really sorry if it is a  simple question but i am a beginner

in my app i need when  user change some thing in the database other users get notified so i followed this link http://devcenter.kinvey.com/android/guides/push

but i don not know how to continue this link seems to deal when i receive notification so how to send one? is there any other tutorial or sample code that i can follow

thanks in advance 


Hi,


Can you confirm a couple of things for me:

  1. Have you set up GCM API key and added it in Kinvey console?
  2. Are you able to manually confirm if push initialization completes? The way you can do it is by observing _messaging column in users's information - it should have a valid json structure along with pushTokens information.

If yes, can you try to send a sample push notification using Kinvey console?

Let me know how it goes.

Regards,
Wani

yes i put this line myClient.push().initialize(getApplication());   after the user log in in my code and i used a sample of BL in your documentation 

here it is 

function onPostSave(request, response, modules) {

    ///

   var push = modules.push, collectionAccess = modules.collectionAccess;

    collectionAccess.collection('user').find({"username": 'student'}, function (err, userColl) {

      if (err) {

       modules.logger.info('Query failed: '+ err);

      } else {

        modules.logger.info( 'sucess'+userColl);

          push.broadcastMessage("Hello", function(err, result) {

            if(err)

              modules.logger.info("error"+ err);

           response.continue();

         });

      }

    });

    ////

but where in my android app can how can i see the message in my android app i crated logs in GCMReceiver and GCMService and made to objects of them in my activity but dont know what should i do next?

    

  

 //response.continue();

}

Hi,


Have you registered the device to receive push notifications? Are you able to confirm if that part is happening properly?


The documentation is covered here: http://devcenter.kinvey.com/android/guides/push#RegisteringtheDevice


Also, what is the BL output you are getting when you execute the BL code?



Regards,

Wani

thank you  very much i read the reference and was triying the samples but i cannot receive any thing in the test devise iam using i have followed this likk http://devcenter.kinvey.com/android/guides/business-logic#Triggeringpushnotifications  impleting the classes GCMService and receiver but i do not know how can i use them in my code i just made logs in all methods in GCMService class but i don't see any thing any help please?

Hi Soha,


You need to do this using Kinvey Business Logic (BL).


You can set up different types of Kinvey BL scripts depending on each use case (http://devcenter.kinvey.com/android/guides/business-logic#types) and execute it to send out push or other notifications accordingly.


Documentation:

  1. Kinvey Business Logic: http://devcenter.kinvey.com/android/guides/business-logic
  2. Kinvey BL reference for sending push notifications: http://devcenter.kinvey.com/android/reference/business-logic/reference.html#push-module


E.g. for a specific collection in data store (database), you can create BL collection hook called onPostSave which will be triggered when an entity in that collection is created/updated.



Regards,

Wani

Kinvey Support

Login or Signup to post a comment