Backendless Support
 
Answered

Can I use AS/Backendless SDK to recieve push notifications in Android/IOS?

Also, Is it possible to recieve silent notifications (no UI "alert"), just to send data to the app?

Thanks in advance.

Leave a Comment

Comments (7)

photo
1

Yes, you can use the AS SDK to receive push notifications.

Support for silent notifications is going to be available in the upcoming release, but it will be only in the native SDKs (not in the AS one).

Regards,

Mark

photo
2

Hi Mark,

Thank you for your quick response.

Silent notifs are a big deal, it's a pity they will not be in AS.. :(

Anyway, I've tried unsuccessfully to do a push notif, but I could not register the device. I don't know if i've done all steps because AS doc is a little scattered. This is my code:

  1. trace("Registering push.");

    RpcClassAliasInitializer.registerClassAliases();

    Backendless.initApp( "14EF85C9-XXXX-XXXX-XXXX-XXXXXXXX", "3A1D0078-XXXX-XXXX-XXXX-XXXXXXXX", "v1" );

    var responder:IResponder = new mx.rpc.Responder(

    function( event:ResultEvent ):void {

    trace("Registry result = "+event.statusCode);

    var registration:DeviceRegistration = event.result as DeviceRegistration;

    trace("Device token = "+registration.deviceToken);

    },

    function faultEvent( fault:FaultEvent ):void {

    trace("Error registering Push: "+fault);

    });

    var deviceRegistration:DeviceRegistration = new DeviceRegistration();

    deviceRegistration.gcmSenderId = "59XXXXXXXX";

    deviceRegistration.channels = [ "My_Channel" ];

    Backendless.Messaging.registerDevice(deviceRegistration, receivedPushNotification, responder);

    trace("push registered?");

In the console I only get these messages:

  1. Registering push.
  2. push registered?

No reference to the OK or KO messages, exceptions, other error messages, nothing else...

I've change android permissions, added libs PN, rpc/framework and locale.

Thanks in advance!

photo
1

Hi Victor, did you managed to implement this on an Android device? I managed to register but not to get the push notifications...

Thanks

photo
photo
1

Hi, same here...The example on documentation uses

  1. Backendless.MessagingService.registerDevice(deviceRegistration, receivedPushNotification, responder);

but this throws a compilation error "property not found".

This compiles right but does nothing...

  1. Backendless.Messaging.registerDevice(deviceRegistration, receivedPushNotification, responder);

photo
1

ok, I managed to register on iOS.

First I included the modified class on this post:

http://support.backendless.com/topic/as3-sdk-open-source-with-blank-function

Then I used this method:

  1. Backendless.Messaging.registerDevice(deviceRegistration, receivedPushNotification, responder);

And last add this to the App XML manifest:

  1. <Entitlements><![CDATA[
  2. <key>aps-environment</key>
  3. <string>development</string>
  4. ]]></Entitlements>

photo
2

Hi Roberto,

Maybe if you could prepare a pull request to our AS SDK with your fixes, it would be just perfect :)

photo
1

hi Sergey, to be honest, I don't know how to do that ;-)

But you can ask to Tushar Scientific, owner of the code and the original post.

http://support.backendless.com/topic/as3-sdk-open-source-with-blank-function

Thanks!!

photo