- This topic has 10 replies, 3 voices, and was last updated 10 years, 1 month ago by support-michael.
-
AuthorPosts
-
NavneetBhartiaMemberUpdate – see http://www.genuitec.com/support-genuitec/viewtopic.php?p=28172#p28172 for the fix.
I am attaching a deviceready event handler in the documentReadyHandler and it works fine with Mobione
But when I am using the same code with MyEclipse and phonegap build the deviceready event is never firedphoneui.documentReadyHandler = function() { document.addEventListener("deviceready", deviceReady, false); } function deviceReady(event) { ... }
support-michaelKeymasterLet me begin by asking if you were successful creating the date-time app in the tutorial. If not, start there to get a working example as a reference pt (a baseline) before customizing it or working on your own projects. After you have the date-time project building and operating correctly try making a small mod such as device-ready handler. If it is successful then compare this project with your main project to identify what is different. Also give GapDebug a try to help more quickly isolate problems.
I added a deviceready handler in the date-time project of the tutorial. It works as expected when I register the devicereadyhandler in the phoneui.documentReady() function. See the screenshot below where my deviceready handler outputs a msg to console.log when it fires. I used GapDebug (http://genuitec.com/gapdebug) to inspect the app when running on my device. See attachment date-time-deviceready.jpg
Attachments:
You must be logged in to view attached files.
NavneetBhartiaMemberHi Michael
Thank you for your reply. I have followed the tutorial and used the datetime project to be sure. The thing is it does not work on the actual device. Please install your application on a device and run it see the QR code for the app
Please install on actual device and check.
You can download the zip of both the mobione date project and the converted project here. I have removed the .metadata folder as it was too big
http://www.dappto.com.au/mobitest.zipLooking forward to hearing back from you
Brandon BatieMemberHi,
One issue is all your alerts are trying to trigger at the same time.
The phone ui document handler is an device ready call and you are placing another device ready call inside that one.My first suggestion is to start smaller. Take out all your custom code so you only have:
phoneui.documentReadyHandler = function() {
alert(“Document is ready”);
}And see if the alert comes up when its ready.
NavneetBhartiaMemberHi Brandon
Have you tried to install this on an actual device. I have removed all alert other than the device ready yet the same. Device ready not firing.
Can you please try it on a device It is not working
phoneui.documentReadyHandler = function() { //alert("documentReadyHandler"); document.addEventListener("deviceready", deviceReady, false); //alert("documentReadyHandlerEnd"); } function deviceReady() { alert("device is ready!!!!"); }
NavneetBhartiaMemberAlso document ready is not the problem. documentready event fires fine. It is the device ready event that never fires
Brandon BatieMemberI will try to install it a little later. You should try separating them as well, the device could already be ready.
phoneui.documentReadyHandler = function() {
//alert(“documentReadyHandler”);
//alert(“documentReadyHandlerEnd”);
}\\Call device ready
document.addEventListener(“deviceready”, deviceReady, false);function deviceReady() {
alert(“device is ready!!!!”);
}If this still does not work I will put together a sample.
NavneetBhartiaMemberHere is the latest code that I tried but still no luck. Please try it on device and tell me if it works for you. I have tried 2 android devices
phoneui.documentReadyHandler = function() { //alert("documentReadyHandler"); //document.addEventListener("deviceready", deviceReady, false); //alert("documentReadyHandlerEnd"); } //attaching deviceready outside document ready document.addEventListener("deviceready", mydeviceReady, false); function mydeviceReady() { alert("device is ready!!!!"); }
support-michaelKeymasterI was able to dig into your zip. The issue is the startup file (date-time.html) is not properly configured. Make the following 2 changes and then rebuild and test. I noticed there was a www/date-time dir in your MyEclipse project which leads me to think that you might have misconfigured the importMobioneProjectContent.ant at one pt. I don’t think that should have resulted in the date-time.html from being edited by the script. Looking into that now.
In the meantime please make the following 2 changes, build an app and test it. deviceready handlers will always be called unless there is an error in the project on startup somewhere. I’m encouraging all phonegap developers to adopt GapDebug to investigate these type of issues. It will point out this issue in 30 seconds on startup. See attachment bad-auto-edits-for-startupfile.png
Attachments:
You must be logged in to view attached files.
NavneetBhartiaMemberHi
That seems to have fixed the problem. However note that running mobione and regenerating the html file will again go back to minimal-ui and rte/cordova.js
So I think this has to be manually edited everytime you import. Also note I think this is the reason people are having the statusbar issue as the line in phoneui.js which uses the statusbar plugin never get executed. It seems the downloaded date-time project has this manually fixed. If you import it directly into MyEclipse it works but if you first run mobione and then import it it does not work. I believe you need to fix this in the docs
//navigator.splashscreen.hide(); if (typeof StatusBar != "undefined") { StatusBar.overlaysWebView(false); }
support-michaelKeymasterI uploaded a new version of the tutorial resource pack (ver 0.1.3). It includes 2 fixes, including the issue affecting your project. See the updated ANN here:
http://www.genuitec.com/support-genuitec/viewtopic.php?f=2&t=7747&p=28112Marking this thread CLOSED.
-
AuthorPosts