Push Plugin for Cordova Android App

0 votes

Hello Vishnu,

 
Hope you are doing well. I want to integrate Push plugin in my cordova app for Android. Could you please provide me the plugin as well any kind of tutorial. Help would be appreciated.
Thanks.
 
Regards,
Prabhjas Singh
asked Oct 31, 2015 in App42 Cloud API-BaaS by prabhjassinghbajwa (25 points)
I am trying to build push services in my existing cordova app. Gone through your tutorial:
 blogs.shephertz.com/2013/12/04/integrating-push-notification-in-phonegap-android-application/

But unable to register : Sending you my logs

11-01 09:41:59.302: I/App42PushNotification(1305): Registration not found.
11-01 09:41:59.415: D/OpenGLRenderer(1305): Render dirty regions requested: false
11-01 09:41:59.491: D/Atlas(1305): Validating map...
11-01 09:41:59.663: I/OpenGLRenderer(1305): Initialized EGL, version 1.4
11-01 09:41:59.716: D/OpenGLRenderer(1305): Enabling debug mode 0
11-01 09:41:59.731: I/qdutils(1305): PartialUpdate status: Disabled
11-01 09:41:59.731: I/qdutils(1305): Left Align: 0
11-01 09:41:59.731: I/qdutils(1305): Width Align: 0
11-01 09:41:59.731: I/qdutils(1305): Top Align: 0
11-01 09:41:59.731: I/qdutils(1305): Height Align: 0
11-01 09:41:59.731: I/qdutils(1305): Min ROI Width: 0
11-01 09:41:59.731: I/qdutils(1305): Min ROI Height: 0
11-01 09:41:59.731: I/qdutils(1305): Needs ROI Merge: 0
11-01 09:41:59.731: I/qdutils(1305): Dynamic Fps: Disabled
11-01 09:41:59.731: I/qdutils(1305): Min Panel fps: 0
11-01 09:41:59.731: I/qdutils(1305): Max Panel fps: 0
11-01 09:41:59.990: I/System.out(1305): com.shephertz.app42.push.plugin.App42GCMService
11-01 09:42:05.111: I/chromium(1305): [INFO:CONSOLE(1)] "Uncaught ReferenceError: registerForPush is not defined", source:  (1)
11-01 09:42:05.119: W/cr.BindingManager(1305): Cannot call determinedVisibility() - never saw a connection for the pid: 1305
11-01 09:42:05.308: I/Timeline(1305): Timeline: Activity_idle id: android.os.BinderProxy@1ac13de8 time:53254644
11-01 09:42:06.572: D/JsMessageQueue(1305): Set native->JS mode to OnlineEventsBridgeMode
11-01 09:42:06.663: I/chromium(1305): [INFO:CONSOLE(8)] "Uncaught ReferenceError: newsService is not defined", source: file:///android_asset/www/scripts/news/home.service.js (8)
I have gone through your several answers regarding the same issue. As i checked stackoverflow questions as well your github repository. And i mentioned everything in my index.html .

1 Answer

0 votes

Hi Prabhjas,

If you are trying to integrate it in your current project then please go through with index.html file that will contains registerForPush function. This function is called from native android side to send device device Id generated from GCM.

Similarly when Push Notification received on Android Native side pushMessageAlert function is called that is defined in index.html file.If you go with index.html or PhoneGapActivity on Android Native side then you will find how the communication will happen between js and Android Native.

If you want to integrate in your own just define function in your main html file that are avialable in index.html file.

Let me know if more queries are concern.

Thanks & Regards

Vishnu Garg

 

answered Nov 1, 2015 by Vishnu Garg (674 points) 1 flag
Yeah! I got that thing but on clicking that message app gets open but no message appears so i need a function which i can call in my app.js file.. And i can put alert in that function so that user can see that message when it clicks on notification.
The main problem is Java in unable to communicate with JS in case of angular. For message you can save message in a file in asset folder and read it from there. Or you can save it in device preferences and retrieve the same using Cordova plugin from preferences.
I am able to solve this problem. but need your help to place .apk at google play store. I tried but google play is not accepting it gives this error.
This app uses software that contains security vulnerabilities for users.

Below is the list of vulnerabilities and the corresponding APK versions that were detected in your recent submission. Please upgrade your app(s) as soon as possible and increment the version number of the upgraded APK.
Have you change the application version in AndroidManifest.xml which you want to update
Yes i have udated that version it gets uploaded their but after checking by google play within a hour i received a mail with explaining error.

Vulnerability    APK Version(s)
Apache Cordova
The vulnerabilities were fixed in Apache Cordova v.3.5.1. For more information about the vulnerabilities, and for guidance on upgrading Apache Cordova, please see https://cordova.apache.org/announcements/2014/08/04/android-351.html. For other technical questions about Apache Cordova, please post to https://www.stackoverflow.com/questions and use the tags "android-security" and "cordova."

20300
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...