Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vibrator is not working on Android #509

Open
goffi-contrib opened this issue Jul 20, 2019 · 5 comments

Comments

@goffi-contrib
Copy link

@goffi-contrib goffi-contrib commented Jul 20, 2019

Hello,

this issue may be related to #501 but is not exactly the same.
Vibrator is not working at all on Android, the following code:

from plyer import vibrator
vibrator.vibrate()

Crash as follow:

Traceback (most recent call last): 
  File "<console>", line 1, in <module> 
  File "/home/goffi/.local/share/python-for-android/build/python-installs/cagou_dev_build/plyer/facades/vibrator.py", line 52, in vibrate 
  File "/home/goffi/.local/share/python-for-android/build/python-installs/cagou_dev_build/plyer/platforms/android/vibrator.py", line 24, in _vibrate 
  File "jnius/jnius_export_class.pxi", line 1034, in jnius.jnius.JavaMultipleMethod.__call__ 
JavaException: No methods matching your arguments, available: [u'(ILjava/lang/String;[JILandroid/media/AudioAttributes;)V', u'(ILjava/lang/String;JLandroid/media/AudioAttributes;)V']

I've tried with Pyjnius and had the same result. The API 26 deprecation should not affect the code here, I'm building with API 28 but running on AP 23 (Android 6).

This issue has also been reported by somebody else at https://groups.google.com/forum/#!topic/kivy-users/rT9P-mmv0RE and on the chat, but without any solution provided.

@YakuIt

This comment has been minimized.

Copy link

@YakuIt YakuIt commented Jul 21, 2019

I'm running into this as well. I'm building for API 27, and running on API 25.

I've found that I can call vibration successfully when I use pyjnius 1.2.0. However when I build again using pyjnius commit kivy/pyjnius@6553ad4 I get the error.

@akshayaurora

This comment has been minimized.

Copy link
Member

@akshayaurora akshayaurora commented Sep 6, 2019

@YakuIt @goffi-contrib can one of you folks please post your bulldozer.spec so I can test ?

@goffi-contrib

This comment has been minimized.

Copy link
Author

@goffi-contrib goffi-contrib commented Sep 6, 2019

@akshayaurora I'm running P4A directly, and I'm using this config: https://repos.goffi.org/cagou/file/tip/.p4a (I have a debug shell allowing to test directly on Android in my app). I did test on Python 2 but my code is now ported to Python 3 and I haven't yet tried to rebuild the Android apk (but I doubt that Python version has anything to do with that anyway).

@goffi-contrib

This comment has been minimized.

Copy link
Author

@goffi-contrib goffi-contrib commented Oct 20, 2019

@akshayaurora I've now ported my apk to Python 3 and tested again:

>>> import plyer 
>>> plyer.__version__ 
'1.4.2' 
>>> from plyer import vibrator 
>>> vibrator.vibrate() 
Traceback (most recent call last): 
  File "<console>", line 1, in <module> 
  File "/home/goffi/.local/share/python-for-android/build/python-installs/cagou_dev_build/plyer/facades/vibrator.py", line 52, in vibrate 
  File "/home/goffi/.local/share/python-for-android/build/python-installs/cagou_dev_build/plyer/platforms/android/vibrator.py", line 24, in _vibrate 
  File "jnius/jnius_export_class.pxi", line 1034, in jnius.jnius.JavaMultipleMethod.__call__ 
jnius.jnius.JavaException: No methods matching your arguments, available: ['(ILjava/lang/String;JLandroid/media/AudioAttributes;)V', '(ILjava/lang/String;[JILandroid/media/AudioAttributes;)V'] 

So this is still failing.

@aldwinaldwin

This comment has been minimized.

Copy link

@aldwinaldwin aldwinaldwin commented Oct 25, 2019

I have the same issue (Python3):

kivy/pyjnius#442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.