Please I need somen to help me before I loose my mind.
I am developing a mobile app with jquery mobile 1.4. The problem is that when users edit a form content it saves in local storage but does not show unless I manually refresh the browser so I implemented the following script
//After the selected employee has been edited
localStorage.setItem("employees", JSON.stringify(employees)); //set the update values to localstorage
alert('Eployee updated Successfully');
$.mobile.changePage("#home_page");
To make the dom refresh so that I dont have to manually refresh I implemented this
window.location.reload('#employee_list_view_page');
return true;
Which works well but when I converted to android using phone gap, once it updates it brings a white screen and the app hangs (like crashing).
Please what other way can I refresh or reload the dom that is more effecient. Or is there a way I can set a timeout for the refresh to stop after some seconds so the blank screen stops.
Thanks
I think what you're after is here: http://api.jquerymobile.com/pagecontainer/
Something like:
$.mobile.pageContainer.pagecontainer("change","index.html",{reloadPage:true});
Unfortunately this is deprecated as of jQuery Mobile 1.4, but the new method reload is affected by a bug.
Have a try and keep an eye on this: https://github.com/jquery/jquery-mobile/issues/7406
Related
My app opens a WebView, which in turn loads a simple page from my remote host. Recently I've been trying to minimise the amount of data usage, by maximising cache usage, and have started using a network connections monitor app like this and this to check what connections are actually being made by my app (and others).
These are showing that, as well as a connection being made to the host when the webview loads, a connection is also being made to nnn.n.nnn.nn.bc.googleusercontent.com. The first of the above apps resolves this to an admin address of Google Inc.
But I have no idea why this connection is being made. My webpage does not have any google-related tracking code or anything like that, has no links to adverts, nothing at all along those lines. And the Android app itself, that loads the WebView, likewise does not at any point try to fetch "user content" from googleusercontent.com.
I would post some code, but since I have no idea where this call is initiated from, I wouldn't know what to show. I would also say that I have noticed on my phone that occasionally a full-page advert will pop up, and I have no idea where it's coming from... but it doesn't happen at the same time as these calls to googleusercontent.com.
Any insight on this would be most welcome.
OK I think I figured it out. My web page makes a call to my node.js app running on Cloud 9... I think that the mysterious nnn.n.nnn.nn.bc.googleusercontent.com must just be where the node app is being hosted. When I call this page from my production app (where the node app is running on heroku) I get a call to a different yet similarly mysterious-looking address: xxxxxxx.eu-west-1.compute.amazonaws.com... so that must be where the heroku node app is hosted.
I'm developing mobile application using cordova ,
the mobile application should be on offline and online mode , i'm trying to get the time from a secure place when the user is offline (if i used device time the user may change it )
so I tried with :
trying to search for a plugin that can interact with the sim card and get the time from it .
searching for a way to detect if the user changed the time in the offline mode
but I don't find a solution
You will have to write some native code to do this, although it won't be much. You could wrap it in your own plugin, or just modify one of the existing ones (the device plugin would make sense). The device plugin on Android is a Java file and you could add a method in their that will call a JavaScript callback when a time change event is detected or just set a flag that a time change happened.
To actually detect the time change see the answer in this Stack Overflow answer:
How to listen to change in time in Android
In addition to the TIME_SET intent, you should listen for the TIMEZONE_CHANGE intent as well.
I have an android app which is a wrapper around my mobile site. We have a site that changes everyday, and I’d like to have a method by which I can notify the user that there’s new content to be had, or just reload it programmatically.
This obviously happens when the app relaunches, but sometimes users will keep the app in sleep mode and re-open it the next day and they see a stale version of the website. Is there any way around without going native? One method I thought off was using a push notification to reload the app (i.e. use GCM to tell the app to reload the page) except I don’t want to push a new version as this would require permission changes and that would break auto-updating. I though of using socket.io for the task as I'm already using it in my app but I don’t think it'll work if the app is the background (will it? I’m an android newbie)
Thanks for any help!
When the application returns from sleep - onResume() of the activity life cycle may be invoked. If you reload the webview on this listener, that should resolve it.
Unless i am missing something very significant, this simple solution might work.
I´m using a loading template to subscribe my client in all needed collections. When I change some stuff there is a HCP to the client that results in a refresh of the page (white blank screen for some ms).
I have 2 questions.
Is it possible to create a template and show it to the client when there is a HCP to avoid the blank screen?
Is it possible to do a HCP only when the app is running in the background on iOS and Android
Currently, there is no way to avoid the white screen when hot code push is happening. On mobile, you can use the mdg:reload-on-resume package (https://github.com/meteor/mobile-packages/tree/master/packages/mdg:reload-on-resume) to only let hot code push happen right when the app is opened. Unfortunately this is still not in the background, but it's as close as you can get right now.
I have written a small app in Cordova with the battery plugin (tried versions 0.2.11 to 0.2.13-dev). The html contains a href to a second page. The deviceready event is fired on the first and on the second page and the battery status eventlistener is added on both pages. But on the second page the battery status event is not fired anymore, when i go back to the first page, it is not fired anymore, too.
I tried on Android 4.1 and Android 4.4 devices.
It seems that the battery status event fires only on the initial page.
Does anyone have experienced the same? Is there eventually a solution or workaround for this?
Many thanks.
According to documentation http://docs.phonegap.com/en/edge/cordova_events_events.md.html#deviceready
I expect this event is only fired once the application is started - meaning the Cordova Javascript parts are loaded and in cache. I expect the Cordova Javascript from cache is used even when loading a second html page.
You may want to use the Javascript window.onload = function ... to execute something when the page has been loaded.