Hide Splash Screen On Android Once Phonegap Site Has Loaded
I have a website that uses media queries to look good on mobiles, I wrapped this up in phonegap so I can have it as an application too. I have set super.loadUrl to my site and this
Solution 1:
It turns out an old include of prototype.js was messing this up. Once I removed that it works awesomely.
For future people the errors I got were:
- App doesn't react to touch, input buttons and hyperlinks can't be used.
- If you press-hold on an input, hyperlink etc it got the orange focus box, but never took me to the link or activated the input button (cursor or keyboard)
- Prototype stopped me getting deviceready at any point, but no JS errors were thrown (except IE not liking addEventListener)
Solution 2:
Try doing this:
<script>functioninit() {
document.addEventListener("deviceready", onDeviceReady, false);
}
functiononDeviceReady() {
navigator.splashscreen.hide();
}
</script><bodyonload="init()">
Although since you are using jQuery you may want to change it to:
$(document).ready(function() {
document.addEventListener("deviceready", onDeviceReady, false);
});
Solution 3:
Frist add the splashscreen plugin as follow:
$ phonegap plugin add org.apache.cordova.splashscreen
Second build the project,"splashscreen.js" will be merged into the "phonegap.js"
$ phonegap local build
Good Luck
Post a Comment for "Hide Splash Screen On Android Once Phonegap Site Has Loaded"