Channel: Appcelerator Developer Center Q&A Tag Feed (device)
Viewing all articles
Browse latest Browse all 250

Core Motion Module: Issue with isDeviceMotionAvailable() function


Hi community,

I'm trying to integrating ti.coremotion module in my Alloy app to create Image Gallery with tilt feature. Something like this widget by CaffeinaLab.

I'm getting the following error when try to load the image inside iPod/iPad device.

[ERROR] Script Error {
        backtrace = "#0 Controller() at file://.../UniversalApp.app/alloy/controllers/ImageGallerySlider.js:1\n#1 () at file://.../UniversalApp.app/alloy.js:1\n#2 t() at file://.../UniversalApp.app/alloy/controllers/ImageGallerySection.js:1";
        line = 1;
        message = "'undefined' is not a function (evaluating 'd.isDeviceMotionAvailable()')";
        name = TypeError;
        sourceId = 58346400;
        sourceURL = "file://.../UniversalApp.app/alloy/controllers/ImageGallerySliderImage.js";
And here is my code snippet used in the project.
var CoreMotion = require('ti.coremotion');
if (CoreMotion && CoreMotion.isDeviceMotionAvailable()) {
    CoreMotion.startDeviceMotionUpdates(function(e) {
        // logic goes here..
    else {
        Ti.API.error("CoreMotion not available");
Can anyone guide me here?

Technical details:

  • Titanium SDK: 3.2.3.GA
  • Alloy version: 1.3.1
  • Device: iPod & iPad (iOS 7.1)

Viewing all articles
Browse latest Browse all 250

Latest Images

Trending Articles

Latest Images