×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    45

    Stopping the Accelerometer

    I'm trying to develop a simple app which requires the Accelerometer.

    Taking a look to some samples on MSDN, I've seen that the classical Start and Stop methods were available.
    Unfortunately, when I wrote the code, I discovered that the Accelerometer, on WP8, has NO Start and Stop methods!

    So the Accelerometer starts collecting data as soon as i call the Accelerometer.GetDefault() method and, even if I don't like this behavior, this is not a big deal.

    The problem is that there's no Stop method and the data won't stop coming even if I set my Accelerometer property to null!

    How can I stop it from collecting data when I don't need it?

  2. #2
    Registered User
    Join Date
    Dec 2012
    Location
    Zagreb, Croatia
    Posts
    73

    Re: Stopping the Accelerometer

    Yes it does have Start/Stop methods on Windows Phone 8. It is Windows Store version that is missing those two methods. If you don't want to receive any updates, unhook the event handler.

  3. #3
    Registered User
    Join Date
    Sep 2013
    Posts
    45

    Re: Stopping the Accelerometer

    Well, I'm working on a WP8 project and there's no start/stop method here!

    It's ok to unhook the event handler, but does the Accelerometer keep on working even if I don't intercept its events? If so, this can be a potential battery issue!

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    427

    Re: Stopping the Accelerometer

    The accelerometer is running anyway as the OS also uses it to determine orientation changes, etc. By getting the default Accelerometer you gain access to it's readings and can then register the event and the reporting interval. Unhooking the event is the best you can do yourself and the system will deal with the rest (e.g. deactivating the sensor completely when it's not needed).

    Given how Piezo-Electric accelerometers work I don't think it should be much of a battery issue, unless there's lots of processing based on it's values.

Similar Threads

  1. stopping outgoing sms
    By noam.segal in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2008-07-20, 15:08
  2. stopping PC Suite
    By liamhartley in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2006-08-02, 09:45
  3. Stopping the exe.
    By SudhaYellapantula in forum Symbian
    Replies: 3
    Last Post: 2005-10-03, 08:52
  4. Stopping skinning of CBA
    By genglish in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-09-08, 09:29
  5. Stopping a IMlet
    By ajvs in forum Nokia M2M
    Replies: 0
    Last Post: 2004-11-11, 13:53

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •