开发者

Ajax request from Blackberry Phonegap application

开发者 https://www.devze.com 2023-02-05 22: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 guideli

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 co开发者_开发百科nfig.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


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号