Ivan6481911
Posts: 0
Joined: Tue Dec 10, 2013 11:25 am

Device Ready issue

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!

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Device Ready issue

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.

Ivan6481911
Posts: 0
Joined: Tue Dec 10, 2013 11:25 am

Device Ready issue

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.

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Device Ready issue

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

Ivan6481911
Posts: 0
Joined: Tue Dec 10, 2013 11:25 am

Device Ready issue

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...

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Device Ready issue

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

Ivan6481911
Posts: 0
Joined: Tue Dec 10, 2013 11:25 am

Device Ready issue

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Device Ready issue

Hi Ivan,

Yes. For now, you just test on browser.

Ivan6481911
Posts: 0
Joined: Tue Dec 10, 2013 11:25 am

Device Ready issue

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

Ivan6481911
Posts: 0
Joined: Tue Dec 10, 2013 11:25 am

Device Ready issue

Thank you!!!

Return to “Issues”