Cordova/Phonegap and HTML5 App cache on Android - android

I'm trying to make an app which is available to users while offline, but updates if it's online . So i was thinking about using the HTML5 cache just for that, caching up the most recent version. The problem is , sometimes it works sometimes it doesnt. I have an index.html page in my Cordova App which sets your window.location to the http online link. Why wouldn't it work all the time? I have my manifest.appcache configured and mime-types enabled, sometimes it will just show a blank page not found ,even though it downloaded a page which included a manifest. Is there anything i'm missing? I put the link setting in index.html after the javascript body load event. It's android that i'm testing , so far i tried with an Iphone 1 time and it worked.
If you guys know more, please share

Related

Cordova - In-App Browser to show website as desktop view

I was creating a Cordova (android) application in which I am using the In-App Browser plugin. I want the website in it to show as desktop view. I tried changing the user-agent with the <preference> (How i can set User Agent in Cordova App) tag in the config.xml file which is actually changing but it doesn't seem to be affecting the website state. I tried Googling that but I found nothing that could solve my problem. If you solved my issue, it would be really great if you could upload an apk for proof: please don't reply if you haven't tested your solution.
EDIT:
The problem is that the user-agent works only the first time you open the app... You have to clear the cache and open the app again so it works.

Load webside in iOS App and Android App, not loading after changes

I have a page that is opened inside a webview (Android) and uiwebview(iOS). When it is in the app, it works perfectly, but when I made a change in the code in the hosting site, the page wont't load in Android or iOS either. It's telling me that "error resource is not available". The page does load after refreshing many times. I don't know what is happening. The page is built in Laravel 5.1 and my hosting site is GoDaddy.
Does anyone has the same problem?
Is the app hosted on godaddy using javascript files? In that case you might want to handle that in android app.
For starters you can try to access the website in chrome/ any browser on android device, if its working, try and delete data/cache of app from settings. Or simply just uninstall and install again.

Refresh HTML5 page in Phonegap?

I have got a fully working phonegap 1.6.1 application, built in HTML5. I'd like to make this page refresh itself from the internet (replace the in-app html file with the online one, and save it for later), but when it is not possible, just do nothing.
It is on Android (2.3.7 & 4.1.2)
Is it possible?
I would really appreciate if you could send me a code (script) that helps.
P. S. I'm doing the job in DreamWeaver without any databases, etc.
Thanks in advance!
You need to whitelist your website in order for it to be allowed to take over the WebView provided by PhoneGap.
http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html
https://build.phonegap.com/blog/access-tags
Are you wanting to replace the actual html with what is found on the corresponding web site or are you trying to update content on the page? One is possible the other is not as your html index is compiled into the adk and not really editable on the fly, per se. You may update content dymanically from the web, but I'm pretty sure it is impossible to re-compile your apk on the android device itself.
However, if your html file is nothing more than a web view or iframe of your web site, then it will work, provided the app may reach the internet. The problem is that your app will not work if not connected to the internet. However, you could write a js routine to pull a default html view when internet access cannot be had.

Using iFrames in Phonegap And App Crashes

I have created an app with PhoneGap 2.0.0 for Android on Eclipse but when I try run the application either on an emulator or my phone(signed application with no errors) it only shows up the static html pages. When I go to a page where I have used iFrame to load another webpage into it, it simply crashes.
This is the screen I get on the emulator and the same message is displayed on my phone as well(SE Xperia X10)
Screenshot of Emulator with The error :
After showing the message the app crashes instantly. Please let me know if I need to add any other permissions or add other settings or make any changes for this to function because the iFrame functions properly outside Phonegap on browser(including phone/desktop browsers)
At least some versions of PhoneGap use an iframe to communicate with the native layer.
I'm most familiar with the iOS version, where there are definite bugs in the browser's support of iframes ( https://issues.apache.org/jira/browse/CB-593 ). I don't know if there is a similar system level issue on android, but there could easily be some part of your code that doesn't expect that second iframe to be there.

Jquery Mobile App not displaying certain images on Android

I have a full Jquery Mobile app the currently builds and looks fine in multiple browsers. I am currently working on getting the version ported using phonegap for android. As it loads up on the phone, it has several images that are loaded depending on localStorage (I originally used cookies but found some android devices aren't too friendly with that). Now, almost all of these triggers load images fine, except the last page. A certain set of images won't load, and I get the error (when running in an emulator Unknown chromium error: -6. Others on the page use the same process and have no problem, and all the images are referred to locally.
Why would this be happening and what can I do to fix this?
Turns out in the android browser, under phonegap, file names are case-sensitive. So it wasn't able to load things with capital letters and such.

Categories

Resources