AJAX on Mobile

Get help using Construct 2

Post » Thu Nov 01, 2012 1:54 pm

Despite the fact it ought to work, both CocoonJS and directCanvas have bugs which prevent the AJAX object working. I've told both @Ludei and appMobi (tagging @AppmobiTyler) about it, but neither have fixed it yet. Try complaining to each company, they might prioritise it higher if real users are asking for it.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sun Nov 04, 2012 10:14 am

I tried even with phone browser export of appMobi , it still doesn't work , i just get a blank screen. any idea ? , any workarounds ? this is very critical for my game project .
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Mon Nov 05, 2012 5:52 am

Well I believe Ashley's done everything he can on his end. As he said, get in contact with @Ludei or @AppmobiTyler about it.
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Mon Nov 05, 2012 2:24 pm

Hey guys,

This sound like a cross domain issue. That is why ajax is not working. A solution would be to find a plugin that allows for JSONP calls. If you can not find one that fits what you need, let me know I can fairly easily add it to the appMobiDev plugin.

If I can ask, what are you looking to use Ajax for in your games? Is it for saving scores, game data, etc..? If so, checkout our playMobi plugin. That is our cloud service for things like leaderboards, badges, game data, etc...

Again, just let me know if you can't find a plugin to fit your needs. I'll be more then happy to help out and add jsonp actions to he appmobiDev plugin.
B
19
S
4
G
5
Posts: 116
Reputation: 4,369

Post » Mon Nov 05, 2012 2:43 pm

@tap - I tested making an AJAX request from appMobi to an address that the server explicitly marked as allowed for cross-domain requests (Access-Control-Allow-Origin: *) and it either crashes appMobi or just does nothing. I'm pretty sure it's something appMobi need to fix. I submitted a bug a while ago.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Nov 05, 2012 2:49 pm

@Ashley, you beat me to the post edit. Man, sometimes I think you aren't a real person and instead a bot :)

[EDIT]
In my attempt to reply quickly and start on the fix, I was too brief and left out a part. So I wanted to edit my previous post stating that in addition to the jsonp code, you need to add bridge code that will pass information from the webview layer down to directCanvas layer. XHR does not exist in DC. Sorry about leaving that out. In my head I wrote it, but it never made it to the screen. :(

I will be adding support into the appMobiDev plugin to handle this and will reply when the changes are up on github.
tap2012-11-05 15:15:21
B
19
S
4
G
5
Posts: 116
Reputation: 4,369

Post » Mon Nov 05, 2012 3:17 pm

@tap - I tried that, and also tried without using DC - either crashed or didn't work. The bug I sent in covers both cases I think. The built-in AJAX object already contains code to try this workaround when in the appMobi container, but it either crashes or does nothing if you try to use it.Ashley2012-11-05 15:18:05
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Nov 05, 2012 3:37 pm

@Ashley - Hmm, ok so you already implemented the bridge code into the C2 engine. That's pretty much all I had in my "bag-o-tricks". :) However, I just talked with our DC guys and they will be looking into it soon. So we will probably have a DC native fix for it. I will update the thread once I know more.
B
19
S
4
G
5
Posts: 116
Reputation: 4,369

Post » Mon Nov 05, 2012 5:08 pm

Thanks for looking into the issue. to your question where are you looking to use Ajax for in your games is that i am developing a kind of puzzle game where it has about 100 puzzles where i use xml to store those puzzle related information and request through Ajax calls to retrieve those when needed.

Hoping we can get the fix soon ! , i am eagerly waiting to test my game on the appMobi platform. :)
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Wed Nov 07, 2012 6:17 am

I even tried with PhoneGap export , when i use Ajax the game doesn't load. Is it a pervasive problem across all the mobile export, is there any workaround ?

I even tried with Safari and Chrome browser for iOS directly on iPhone , that seems to work. i am basically accessing it from the http://machinename.domain.com



please advise this is really blocking me from testing on the mobile/tablet devices as an app.


Here is my stripped down capx of my game,

https://dl.dropbox.com/u/80050021/TestAjax.capxtringio2012-11-07 06:58:34
B
16
S
4
Posts: 248
Reputation: 2,267

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: makkancs and 23 guests