plyer accelerometer not implemented error on Android phone
<p>I installed Qpython (Python 2.7) and plyer on may android phone (Samsung Galaxy J5, with accelerometer - without gyroscope). I want to read the accelerometer values. Simply I enter three lines of code on the console:</p>

<pre><code>from plyer.facades import Acceleromter 
acc = Accelerometer() 
print acc.acceleration
</code></pre>

<p>and I get NotImplementedError. What am I missing?</p>

<p>EDIT: additional findings:</p>

<p>An alternative way to call the accelerometer is like the following. Rather than going through facades, import accelerometer (with small a) directly from plyer, so:</p>

<pre><code>from plyer import accelerometer
</code></pre>

<p>this command looks like working fine with no errors. But if I question what accelerometer is like just typing</p>

<pre><code>accelerometer
</code></pre>

<p>on the python console the I get a lot of jnius errors, ending with:</p>

<pre><code>File "jnius_export_class.pxi", line 44, in jnius.jnius.MetaJavaClass.__new__(jnius/jnius.c:13255)
SystemError: NULL result without error in PyObject_call
</code></pre>

<p>But it gives a hex address for the module, so the sw is there. But most probably can not access the hw.</p>

<p>I have checked the CPU-Z application is closed. But could it be possible that somehow CPU-z blocks the access by installation setup, even if it is closed? When I open it, I can see accelerometer is working.</p>

<p>According to the <a href="https://github.com/kivy/plyer/blob/master/plyer/facades/accelerometer.py" rel="nofollow">documentation</a>, it appears you must first enable the accelerometer. Without doing so, it will throw a <code>NotImplementedError</code> exception as provided in this code:</p>

<pre><code>def enable(self):
     '''Activate the accelerometer sensor. Throws an error if the
     hardware is not available or not implemented on.
     '''
     self._enable()
</code></pre>

<p>Further down the code, you will see this:</p>

<pre><code>def _enable(self):
        raise NotImplementedError()
</code></pre>

<p>I might not have explained myself fully but upon inspecting this code, you should be able to determine what is causing this error. Primarily, it could be that the app (QPython) or hardware just does not support this feature.</p>

android python