Page 1 of 2

Device Ready issue

Posted: Tue Dec 10, 2013 11:25 am
by Ivan6481911

Hello!
I have created application with just one event Device ready. I test on iPhone4 iOS5,6,7, but alert is never showed. startScreen - Device Ready - alert("Alert");
Load works well, but not Device Ready Can anyone help with that? Many thanks!


Device Ready issue

Posted: Tue Dec 10, 2013 2:00 pm
by Illya Stepanov

Hello Ivan,

Better not to use Device Ready event in this case. The Device Ready - is used for other purposes before the page is shown.

You can use Load page or Show page event for this.


Device Ready issue

Posted: Tue Dec 10, 2013 2:12 pm
by Ivan6481911

Alert was for test only.
I have to download file with FileTransfer and it has to be created when device is ready. I have tried to download after 30 sec screen was loaded, but error "FileTransfer is not defined" appears.
The problem is - I cannot get Device ready event.


Device Ready issue

Posted: Tue Dec 10, 2013 2:21 pm
by Illya Stepanov

Please explain with more details what you are trying to do?


Device Ready issue

Posted: Tue Dec 10, 2013 2:46 pm
by Ivan6481911

I want to download image file with this javascript code:

var fileTransfer = new FileTransfer();
var uri = encodeURI("some_url");

var filePath = 'some_path';

//download a photo!
fileTransfer.download(
uri,
filePath,
successDownload,
failDownload
);

function successDownload(entry) {
alert("download complete: " + entry.fullPath);
}

function failDownload(error) {
alert("An error has occurred: Code = " + error.code);
alert("upload error source " + error.source);
alert("upload error target " + error.target);
}

But I have error "FileTransfer is not defined".

Where do I have to add this code:
document.addEventListener("deviceready", onDeviceReady, true);
function onDeviceReady() {
alert ('123');
}
?

Also I wanted to show alert when Device Ready event. I did following startScreen - Device Ready event - javascript with alert only. But alert was not showed, that means, that event was not called. I test on iPhone iOS 6,7. I have created new project and added following to get event startScreen - Device Ready event - javascript with alert only. But no result. It seems to me, that event is not catched for some reason. Load event works...


Device Ready issue

Posted: Tue Dec 10, 2013 5:19 pm
by Illya Stepanov

Are you testing with .ipa files on all these devices? Or how you testing this?


Device Ready issue

Posted: Wed Dec 11, 2013 8:27 am
by Ivan6481911

I test using barcode. I downloaded Barcode scanner application - scan code and run application with it. Is it wrong? Should I run .ipa file?


Device Ready issue

Posted: Wed Dec 11, 2013 8:29 am
by Kateryna Grynko

Hi Ivan,

Yes. For now, you just test on browser.


Device Ready issue

Posted: Wed Dec 11, 2013 9:12 am
by Ivan6481911

Yes, it was the problem. I downloaded XCode code and test on iPhone simulator and it works.


Device Ready issue

Posted: Wed Dec 11, 2013 9:12 am
by Ivan6481911

Thank you!!!