Hi All,

Unfortunately i always get this error (Cordova is not defined) on my browser, and it didnt work on mobile phone too..

I am building an app based on Sencha Touch 2.4.2 packaged with PhoneGap.

I followed both "Phonegap Build" and "Cordova / PhoneGap" Guide.. Nothing works.. I cannot get my app to generate the token to be registered..

Anyone had the same problem before?

Many thanks!

[EDIT] - Kindly see code below... function initPushwoosh() { console.log('here 01'); var pushNotification = cordova.require("com.pushwoosh.plugins.pushwoosh.PushNotification");

console.log('here 02');
//set push notifications handler
document.addEventListener('push-notification', function(event) {
    //get the notification payload
    var notification = event.notification;

    //display alert to the user for example
    alert(JSON.stringify(notification));
});

console.log('here 03');
//initialize the plugin
pushNotification.onDeviceReady({appid: "81A18-9CB55", serviceName: ""});

console.log('here 04');
//register for pushes
pushNotification.registerDevice(
        function(status) {
            var pushToken = status;
            alert('push token: ' + pushToken);
        },
        function(status) {
            alert(JSON.stringify(['failed to register ', status]));
        }
);

}

on launch() function i have added

document.addEventListener('deviceready', this.onDeviceReady, false);

On my console, i got "here 01", and then it stop...

On Chrome Console, i get "cordova is not defined"

asked 14 Aug '15, 00:30
Tupai86's gravatar image

Tupai86
1113

edited 14 Aug '15, 01:07

Hi, have you tried contacting our support team regarding this issue?

permanent link
answered 18 Aug '15, 10:53
Benedict's gravatar image

Benedict
7127

Hi again :)

Turn out, you have to specify the CORRECT (latest i guess) Pushwoosh plugin for Phonegap Build.

Oh PW documentation, we were asked to add to www/config.xml

<gap:plugin name="pushwoosh-cordova-plugin" source="npm"/>

When i use below instead

<gap:plugin name="com.pushwoosh.plugins.pushwoosh" version="3.4.2"/>

it works :) no more "Cordova is not defined" error ;D

permanent link
answered 19 Aug '15, 04:05
Tupai86's gravatar image

Tupai86
1113

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×165
×26
×2

question asked: 14 Aug '15, 00:30

question was seen: 2,506 times

last updated: 19 Aug '15, 04:05