简体   繁体   中英

Sencha touch, android and webserver

Im new to sencha touch and I am developing a database application. The application works fine if it accessed thru a mobile web browser. I want to package my application to android but I am worried that it will not run because of the way I access my webserver. This is how I access data from my webserver:

Ext.define('App.store.positionStore', {
   extend: 'Ext.data.Store',

requires: [
    'App.model.positionModel'
],

config: {
    autoLoad: false,
    model: 'App.model.positionModel',
    storeId: 'positionStore',
    proxy: {
        type: 'ajax',
        url: './positionservlet',
        reader: {
            type: 'json',
            rootProperty: 'position'
        }
    }
},

callback: function() {

}

});

If i try replacing

url: './positionservlet',

to

url: '127.0.0.1:8080/positionservlet'

I'll be having a problem with my session since It will require me to put "Access-Control-Allow-Origin" on my header. Any suggestions will be really appreciated.

Have you tried to package the app using PhoneGap?

If you enable PhoneGap to reach your URL (and, of course, you expose your "positionservlet" API to the extern) you should be able to reach it without Cross-Domain issues

the way your application access to the database is abstacted to the phone Operating system. it should work just fine in a native app as long as it work on webapp mode.

if you configure PhoneGap for your app correctly, you should have a working app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM