Reputation: 15455
I have this situation - PhoneGap app running in Android. It uses external API on my server. It might happen that I will change API structure so I will need to perform update of my mobile app to a newer version. Is there some automatic or half-automatic way how can I force update of the Phonegap app on the Android phone ?
I can display message to the user, that the app is outdated and he should go to Android Market and update the app from there, but I am looking for some more comfortable way how to force this update.
EDIT - Question specification:
I am not looking for a way how to load external script on application startup. I am looking for PhoneGap-Android-specific solution how to invoke application update.
Upvotes: 6
Views: 6985
Reputation: 15455
Ok, I've finally found a solution to my problem.
I use this PhoneGap plugin to launch Android Intent, specifically its Intent.ACTION_VIEWS described here in Android docs.
This successfully fires Android Market App with the option to update my app.
Upvotes: 4
Reputation: 1
you can load your javascript-functions on initialization-time from your server. If you have jQuery try this:
<html>
<head>
<script type="text/javascript" charset="utf-8" src="jquery.js"></script>
<script>
function init() {
$.getScript("http://yourserver.com/code.js", function(){} );
}
function doSomething() {
alert('sorry! functions not loaded!');
}
</script>
</head>
<body onload="init()">
<input type=button value="doSomething();">
</body>
</html>
The file code.js look like
function doSomething() {
alert('Doing something wonderful');
}
Upvotes: -1