Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28272

Android: Accelerometer spams warning messages when exiting app

    Details

    • Story Points:
      3
    • Sprint:
      2020 Sprint 24, 2020 Sprint 25

      Description

      Summary:
      After setting up an "update" event listener to Ti.Accelerometer, the app will spam V8 warning messages to the log after backing out of the app. The warning messages won't stop until you relaunch the app or you remove the event listener.

      Steps to reproduce:

      1. Build and run the below code on Android.
      2. Back out of the app.
      3. Notice the log is spammed with the following warning.
        [WARN] V8Object: (main) [xx,xx] Runtime disposed, cannot fire event 'update'

      function onAccelerometerUpdate(e) {
      	Ti.API.info(`@@@ (x,y,z) = (${e.x},${e.y},${e.z})`);
      }
      Ti.Accelerometer.addEventListener("update", onAccelerometerUpdate);
      

      Work-Around:
      Remove the event listener before the app exits, which you can do via the Ti.App "close" event.

      function onAccelerometerUpdate(e) {
      	Ti.API.info(`@@@ (x,y,z) = (${e.x},${e.y},${e.z})`);
      }
       
      Ti.Accelerometer.addEventListener("update", onAccelerometerUpdate);
       
      Ti.App.addEventListener("close", () => {
      	Ti.Accelerometer.removeEventListener("update", onAccelerometerUpdate);
      });
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Samir Mohammed
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration