Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:45:06+00:00 2026-06-14T03:45:06+00:00

The application is in PhoneGap. I am using push notification feature with https://github.com/marknutter/GCM-Cordova I

  • 0

The application is in PhoneGap. I am using push notification feature with https://github.com/marknutter/GCM-Cordova

I implemented the whole feature and it worked fine until yesterday. When I checked the app last day, push notification is not working when the app is not running. All notifications are receiving on my device, clicking on the message opens the app.

But the controls are not receiving at the javascript portion where message notification handles.

Code from file GCMIntentService.java:

JSONObject json;
json = new JSONObject().put("event", "message");

json.put("message", extras.getString("message"));
json.put("link", extras.getString("link"));

Log.v(ME + ":onMessage ", json.toString());

GCMPlugin.sendJavascript( json );
// Send the MESSAGE to the Javascript application

This code will work when the message received. But at that time, App is not running.

When I click on the notification message, the app opens as usual, not registering the message event; thereby not getting the control in JavaScript to handle push notification.

Code for CORDOVA_GCM_script.js is available at:

https://github.com/marknutter/GCM-Cordova/blob/master/assets/www/CORDOVA_GCM_script.js

Note: It works fine when the app is running.

EDIT:
The notification runs sometimes. JavaScript is getting message event randomly.

EDIT 2:

I definitely know the problem.

From the java file, it triggers the javascript code when opening the app by clicking on the push notification message. But at that time, the WebView is not loaded, so not able to execute the script (which is an event trigger). Is this is the condition, everyone using the plugin will experience the same. Is there any workaround or any fix for it?

Am I doing anything wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:45:07+00:00Added an answer on June 14, 2026 at 3:45 am

    Using GCM-Cordova plugin will not handle the notification correctly if the application is not running. It is because the WebView was not loaded at the time when the plugin initiate the javascript.

    Solution:

    • Modified the plugin code to save message data as temporary when the notice arrives.
    • Created another plugin with methods to read this loaded data and clear data.
    • Call my custom plugin method on deviceready and checked if there any data.
    • If there any, clear the locally stored data and invoke the method to show notice message.

    Finally able to solve this issue with the help of two plugins – GCM-Cordova and custom plugin.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build phonegap application using the API give on https://build.phonegap.com/docs/api It requires
Am developing a android application using phonegap(Cordova 2.0.0). I need the retrieve the device
I am making application using phonegap in android. I am using cordova 1.6.1 I
I'm writing an HTML5 mobile application, and using PhoneGap to push it to the
I am developing iPad application using phonegap (cordova 1.9.0). I need to get current
I'm writing an iOS application using PhoneGap (aka Cordova), I have a simple html
i am new to phonegap application development,i want to use push notification in my
I'm working on a phonegap application using cordova 1.9. I have a syntax error
I'm building my application using PhoneGap Build and all builds are ok with the
I developed an iPhone application using PhoneGap everything works fine, I sent the app

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.