简体   繁体   English

Sencha touch,Android和Web服务器

[英]Sencha touch, android and webserver

Im new to sencha touch and I am developing a database application. 我是sencha touch的新手,我正在开发数据库应用程序。 The application works fine if it accessed thru a mobile web browser. 如果通过移动Web浏览器访问该应用程序,则该应用程序可以正常运行。 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. 我想将我的应用程序打包到android,但是由于我访问网络服务器的方式,我担心它不会运行。 This is how I access data from my webserver: 这是我从Web服务器访问数据的方式:

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. 我的会话会出现问题,因为它将要求我在标题上放置“ Access-Control-Allow-Origin”。 Any suggestions will be really appreciated. 任何建议将不胜感激。

Have you tried to package the app using PhoneGap? 您是否尝试过使用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 如果启用PhoneGap来访问URL(当然,并且将“ positionservlet” API暴露给外部),则应该能够访问它而不会出现跨域问题

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. 只要它在Webapp模式下运行,它就可以在本机应用程序中正常运行。

if you configure PhoneGap for your app correctly, you should have a working app. 如果为您的应用正确配置了PhoneGap,则应该有一个可以正常运行的应用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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