How to integrate Sencha Touch 2 into a Cordova project (Phonegap)

I am trying to integrate the ST2 application into PhoneGap; but i have problems.

I added cordova.js in app.json:

{   
    "path": "resources/js/cordova-1.6.1.js",
    "update": "delta"
},
{   
    "path": "resources/js/test.js",
    "update": "delta"
}

Test.js:

function alertDismissed() {}

function showAlert() {
    navigator.notification.alert(
        'You are the winner!',  // message
        alertDismissed,         // callback
        'Game Over',            // title
        'Done'                  // buttonName
    );
}

Inside the view, I created a dummy button:

items: [{
    text: 'test',
    action: showAlert(),
}],

When I press the button; the function 'showAlert ()' starts correctly; but it doesn't execute correctly, I have an error:

Uncaught TypeError: Cannot call method 'alert' of undefined

Obviously, because the navigator object does not start.

Question: is it possible to run the / senchatouch 2 cordon too? If so, what is the correct way to do this?

SOLVED:

Add cordova.js to app.js

    {   
        "path": "resources/js/cordova-1.6.1.js",
        "update": "delta"
    },
    {
        "path": "sdk/sencha-touch.js"
    },
    {
        "path": "app.js",
        "update": "delta"
    },
+3
source share
3 answers

Just include the cordova.js file from index.html.

+3
source

you can link to the following blog for integrating senchatouch and phonegap with a custom plugin:

http://hynridmobileapps.blogspot.in/

0
source

All Articles