Fix an issue that getDeviceId can fail after deviceready