【发布时间】:2015-05-30 05:16:12
【问题描述】:
我正在开发一个具有多个子域的项目。我将 Sencha Touch 框架和 Cordova 用于 android 应用程序。在浏览器项目中工作正常。我为发布模式构建了带有签名 apk 的 android apk。
我在用 ajax 处理服务器时遇到了严重的问题。每当我尝试使用 ajax 到达服务器端时,用户会话就会被破坏。
我也对我的 cordova config.xml 设置有疑问。
我的问题是:
我的项目网址如 *.quiz.co 。所以如何配置我的 config.xml 文件以及如何为我的项目指定自定义 url。如果我使用 window.open() 或 top.location.href 或任何它重定向到我的自定义域 url 但我的 android apk 项目基于 prodution 代码而不是 apk 代码。
当我在手机中启动我的 android apk 时,它的起始 URL 是“file:///assets/www.index.html”。那么我怎样才能基于自定义域(如 *.quiz.co)运行我的应用程序
当我使用重定向到自定义域时。服务器端用户会话在每个 ajax 调用中被破坏。那么如何在ajax调用中维护用户会话?
config.xml:
<?xml version='1.0' encoding='utf-8'?>
<name>Master Quiz</name>
<description>
Quiz Application for Android platform.
</description>
<icon src="www/img/icon.png" />
<icon src="www/img/icon.png" platform="android" density="ldpi" />
<icon src="www/img/icon.png" platform="android" density="mdpi" />
<icon src="www/img/icon.png" platform="android" density="hdpi" />
<icon src="www/img/icon.png" platform="android" density="xhdpi" />
<content src="index.html" />
<platform name="android">
<preference name="Fullscreen" value="true" />
</platform>
<feature name="InAppBrowser">
<param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser" />
</feature>
<!-- Wildcards are allowed for the protocol, as a prefix
to the host, or as a suffix to the path -->
<allow-navigation href="*" />
<!-- Allow all unrecognized URLs to open installed apps
*NOT RECOMMENDED* -->
<allow-intent href="*" />
<!-- Don't block any requests -->
<access origin="http://*" />
</widget>
Android 权限:
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
【问题讨论】:
标签: android ajax .htaccess cordova sencha-touch-2