“AppMobi.device” [Undefined] is not an object…getting error when testing on device

StackOverflow https://stackoverflow.com/questions/8830966

  •  27-10-2019
  •  | 
  •  

Question

I want to check the "device model" on which app is running.

For this i used following funciton

function CheckCurrentDeviceModel() {

var Device = AppMobi.device.model;   
try {       
    Device = Device.toLowerCase();
}
catch (Error) {

    alert(Error);
}

return Device;

}

This is how i called :

var device = CheckCurrentDeviceModel();

On appMobi "Emulator" its working fine but getting following error when checking on device

TypeError: Result of expression "AppMobi.device" [Undefined] is not an object

Any help would be highly appreciated.

Thanks

Was it helpful?

Solution

I answered this over on the AppMobi forums, but your issue is most likely you care calling this before the appMobi.device.ready event is fired. If you look in your code, there should be a listener for that event. Move your call up to that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top