deviceready won't fire in Phonegap 1.0.0 on Android

前端 未结 2 1118
我在风中等你
我在风中等你 2020-12-29 14:52

I\'ve tried to setup Phonegap on Android and deviceready won\'t fire. The reason is that DeviceInfo.uuid is always null/undefined.

It seems

2条回答
  •  被撕碎了的回忆
    2020-12-29 15:31

    If you want some function to execute when the device is ready do something like this

    document.addEventListener("deviceready", onDeviceReady, true);
    // PhoneGap is now ready
    
    function onDeviceReady() {
    // Write your code here
    }
    

    I am not sure why your code is not working.Try placing the document.addEventListener outside the scope of the function.

提交回复
热议问题