android can't see web service - javascript

I've written my first Android app (Sencha Touch + Phonegap using Eclipse on PC). It pulls some JSON from a WCF service. It works fine in the emulator.
I've now put it on my phone (Samsung GT-19100T running Gingerbread). The app runs but hangs when calling the service. The phone just shows the loading animation. The server shows no request has reached it. The phone can browse the net ok.
EDIT: I should add that the problem is not the server. I can browse to the same services ok on PC, and we have an iPhone app that works with it fine.
The only other strange thing I've noticed is that if I browse to the endpoint on iPhone or PC, I get the JSON text in the browser. If I try it on the android's browser it says "cannot download".
How do I go about diagnosing this?
Is there some sort of option on the phone?

found it. The answer is to SHOOT ME NOW.
the URL had been entered so long ago I forgot all about it, including little details like the fact that it used an internal ip address.
Total facepalm. No, that won't do it. Let's try a facedesk...

Related

Service Worker not working for Mobile Web (Chrome, Firefox, IE)

I set up a service worker for a static web application that needs to work on mobile phones. I'm using react/webpack2 for this application.
Service Worker installs and works greatly when I open the application via desktop, but when I try to visit the application through mobile, it does not install.
When SW finishes installing, it gives you an alert message ("onInstalled");
https://abo-deg.surge.sh (here is an example)
https://abo-deg.surge.sh/survey/background
https://github.com/strongharris/sample (sw.js located inside src, main entrypoint: src/index.js, webpack.config)
The alert message shows up via desktop, but not on mobile browsers.
Am I missing something? Is there a different way to set up a service worker for mobile web applications? Any resources, or tips, or guesses would be greatly appreciated.
I think the answer is pretty simple. Your server does not automatically transfer you to https://abo-deg.surge.sh when you type abo-deg.surge.sh on your mobile.
I was able to run it on Chrome Mobile by typing full URL with https://
Service worker API is available only for websites running over HTTPS, because
Having modified network requests wide open to man in the middle attacks would be really bad
https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
Please keep in mind, that your code will work only on these browsers, so don't expect it to work on iOS

Test websocket app on iPhone, Python Flask-SocketIO and Javascript

My app, Python/Flask and vanilla Javascript, is running just fine on my Mac's browsers and I have previously also been able, making sure I'm on the right network, to test my app on Safari on my iPhone 6. I did this by pointing my mobile browser to the IP given by ifconfig on my Mac and correct port. However, after adding Flask-SocketIO, which should allow for Websocket support or atleast long polling, I am no longer able to test my app on my iPhone. All is still fine on Macs browsers but all I get on my iPhone is "Safari could not open the page...".
My app is served over port 5000 but Ive also tried over 80 without any success. I've cleared cache and cookies as well, of course.
Has anyone experienced something similar or have any idea what is going on?
Mobile Safari needs a Content-Security-Policy meta tag. See more at https://developers.google.com/web/fundamentals/security/csp/

Layout distorted when viewed on mobile

I am developing a web site on my localhost. I used the following technologies:
CodeIgniter in my backend, Bootstrap and JQuery on front.
The problem is, when I viewed my site on my phone when accessing my localhost, it got distorted , css does not load correctly, and it seems that javascripts doesn't work. I can't even login.
Why is that so?
Below is the print screen when viewed on mobile.
I am confused where the things got wrong. But I suspect, it is on codeigniter.
Your replies will be appreciated!
The most likely scenario is that the base_url in your config file is set to something like 'http://localhost/ssmis/'.
This is fine for local development, as you're accessing the site on localhost. However, localhost won't work on other machines in your network, so as you noticed you have to enter in the IP address of your computer to test the app. This causes an issue because all your internal URLs in your app still point to localhost, which your mobile device can't access, so assets and URLs (basically, your entire app) won't work.
The solution is to update your base_url to your IP. For example, you can try changing it to 192.168.43.159/ssmis/ for testing. Don't forget to change it back when you want to work on your local machine again.

Very strange Parse.com app Error 100

I have a very strange problem with my Parse.com app.
First of all, here's the link: linksync.parseapp.com (I provide it here so you can view source code)
Everything was fine until now..
Recently I was unable to log in with my account from my Android phone. As I'm the owner of site, I changed my pass in Parse.com data browser and tried again. No luck! I tried logging via PC Browser - ok.
That's what I have for now:
When I log in from Android Browser - Login failed
When I try to register new account to my website from Android Browser - Error: 100 XMLHttpRequest failed: {}
When I try to log in from my Android app for this website - Login fail
BUT!
When I log in from another Android phone (either from Android browsers or my app) or from any PC, it works!
Looks like my phone is cursed :( I even tried reflashing ROM and updated in to different version, but still can't make this work.
Oh, and from my phone another app, that uses parse.com, doesn't work. It's just as if I'm banned with the only device.
Guys, what can I do to fix it? Any Parse.com devs here?
I had this too, didn't have a clue what caused the error.
Well, you know what?
It turned out that I had no network connection on my phone!
After turning on WIFI on y phone it just worked fine, of course.
Takeaway: it's probably a good idea to build a network connectivity check into your app. When it starts up and there is no connectivity you give a warning to the user and quit (or continue to run in 'offline' mode).

Problem with DWR and Android-Browser

I am experiencing a problem with accessing an application from the Android-browser.
The application uses DWR to persist connections to the clients that are connected with it.
Everything works fine for me, except that if the application does not send any data to the client on the Android-phone for 2 minutes, the connection seems to be lost and no data arrive at the client. The same scenario works just fine on Firefox, Opera and Chrome. If the pause between two data transfers is less than 2 minutes, it works just fine.
So, now my question:
Is there some timeout setting for the android browser that I am missing? Or is this some built-in bug/feature/whatever that I cannot circumvent?
I know that I could prevent this from happening with some sort of heartbeat, I would just like to why this is happening.
Thanks in advance, Max
btw: Everything (server, clients) runs on my machine and I am testing this on the android emulator with Windows XP
Android emulator version 1.10 (build_id CUPCAKE-150240)
Could it be that the Android system is garbage collecting your activity and thus loosing your web browser and closing the persistent connection?
Perhaps you could check this by looking in you logcat (on android end) or webserver logs (on remote end)?
if this is the case, you would need to add reconnect code into the onresume/onstart method in android.

Categories