Ajax request from Blackberry Phonegap application

别来无恙 提交于 2019-12-12 14:49:02

问题


I am creating an application for Blackberry (OS 5.0 and higher). I don't have any past experience in mobile development. I have created a sample application that is working fine (by following guidelines mentioned in http://wiki.phonegap.com/w/page/31930982/Getting-Started-with-PhoneGap-BlackBerry-WebWorks). I have installed

  • JDK - version 1.6.0_23
  • Apache Ant - 1.8.2
  • BBWP - 1.5.1.22
  • phonegap - 0.9.3

(Running on BlackBerry 9550 Simulator)

What I want to do is a simple AJAX request to domain (i.e. www.sampledomain.com - where www.sampledomain.com is hosted on my local server.)

I have added following in www config.xml file

<access uri="http://www.sampledomain.com" subdomains="true" />

The problem is that when I send Ajax request I get the message "Error: Error requesting resource.".

(I am not getting any request in apache access log for www.sampledomain.com).

Any one know what can be the reason for that? And how can I fix that? Thanks


回答1:


First the quick answer:

In your SDK path you will find an MDS proxy \BlackBerry\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components\MDS\run.bat Run that and you should then be able to make requests to the internet.

There are many different ways you can connect to the internet on a BlackBerry and you now have a lot of reading to do:

This is a fantastic link to start you on your path http://supportforums.blackberry.com/t5/Java-Development/Connecting-your-BlackBerry-http-and-socket-connections-to-the/td-p/206242

Cheers

Ray




回答2:


I had the same problem for days when trying to make connections to my web server using jQuery's ajax function and posting forms, I tried so many ways to make it work with no success and finally things solved when i ran the run.bat file on the SDK directory.

I wonder, how on earth is one supposed to know that? RIM has so much to improve on their API's documentation.



来源:https://stackoverflow.com/questions/4744115/ajax-request-from-blackberry-phonegap-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!