Support Topics Documentation Slack YouTube Blog

Showing push notification message in App

(Feras AlSaab) #1


I would like to send a push notification from the web client and then show that message as a popup when the user opens the app? Therefore is it possible to collect or read messages in the app as strings?


Feras A.

(Sergey Kukurudzyak) #2

The messages are not persisted, so they are not stored to the server. Your app can collect messages and then shows it. Also you can persist all messages using before or after event handlers Each time when some one push notification, your bussines logic may save this message to Backendless Data

(Feras AlSaab) #3

Awesome, How do I collect messages and then show them?

(Sergey Kukurudzyak) #4

first of all read doc

in the section Manifest Configuration you will find information about BackendlessPushService. so you have to create class:

public class MyPushService extends BackendlessPushService
  public boolean onMessage( Context context, Intent intent )
    String message = intent.getStringExtra( "message" );
    Toast.makeText( context, 
                    "Push message received. Message: " + message, 
                    Toast.LENGTH_LONG ).show();
    // When returning 'true', default Backendless onMessage implementation 
    // will be executed. The default implementation displays the notification 
    // in the Android Notification Center. Returning false, cancels the 
    // execution of the default implementation.
    return false;

So you have to return false here and save string message some where

(Feras AlSaab) #5

thank you and for iOS in swift?

(Feras AlSaab) #6

thank you and for iOS in swift?

(Olga Danylova) #7


Backendless push notifications aren’t different from the standard iOS push notifications. You can save the received payloads into UserDefaults for example. Maybe this could be helpful: