D
D
darwin_usb2014-11-12 12:12:13
phonegap
darwin_usb, 2014-11-12 12:12:13

Push notifications in build.phonegap. what and how?

You need to add Push notifications to the androyd project on build.phonegap
went through all the registration in Google
made this page for the test

<html>
<meta charset="UTF-8" />
<head>
<title>Push</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" charset="utf-8" src="cordova.js"> </script>
<script type="text/javascript" src="PushNotification.js"> </script>
<script type="text/javascript">

var pushNotification;


function onDeviceReady()
     {

     pushNotification = window.plugins.pushNotification;
     pushNotification.register(successHandler, errorHandler, {"senderID":"856966176914","ecb":"onNotification"});

     function successHandler (result) {alert('s= '+result);};
     function errorHandler (error) {alert('e= '+error);};

      function onNotification(e) {

     alert(e.event+' - '+  e.regid);

     };


     };

document.addEventListener("deviceready", onDeviceReady, false);
</script>
</head>
<body>
PUSH
</body>
</html>

made a simple config
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:gap="http://phonegap.com/ns/1.0"
id="com.simplecall.example"
version="1.0.1" >
<name>PUSH</name>
<description>PUSH</description>
<gap:plugin name="com.phonegap.plugins.pushplugin" version="2.4.0" />
<preference name="permissions" value="none"/>
</widget>

all rights in the application are included.
as a result, only OK comes out in the successHandler function and that's it. No more action is taking place. Can anyone give me some advice on what I did wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question