Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • PhoneGap-How to handle Push notification when application is resumed?

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 372
    Comment on it

    Hello friends,

    As we have seen, cordova push plugin only provides access to notification action when we click on notification from status bar, but if we want to perform that action without clicking on notification we have to add some extra code.

    1. First of all open file under com.plugin.gcm from eclipse project
    2. you will find the below method:
    public void createNotification(Context context, Bundle extras)
    3. You will find below lines:
    mBuilder = new NotificationCompat.Builder(context)
    4. At the end of the above object add the following property
    5. Now implement Following code in javascript side in NotificationGCM(e) function: case 'message':
         if ( e.foreground ){
                //The user touched a notification in the notification tray.
                //when app in background and to the perticular page.

    Here e.msg is the data or message which is returned by the GCM.

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: