Я пытаюсь заставить мой телефон вибрировать при нажатии кнопки, но я не могу заставить его работать.
Когда я делаю vibrator.vibrate(1000)
, в моей консоли появляется ошибка:
04-29 15:11:45.103 27494 27585 I python : Exception in thread Thread-1:
04-29 15:11:45.103 27494 27585 I python : Traceback (most recent call last):
04-29 15:11:45.104 27494 27585 I python : File "/home/alexandrumarcel/projects/kivy-apps/rextester/.buildozer/android/platform/build/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/threading.py", line 917, in _bootstrap_inner
04-29 15:11:45.104 27494 27585 I python : File "/home/alexandrumarcel/projects/kivy-apps/rextester/.buildozer/android/platform/build/build/python-installs/rextesterdroid/jnius/__init__.py", line 54, in jnius_thread_hook
04-29 15:11:45.104 27494 27585 I python : File "/home/alexandrumarcel/projects/kivy-apps/rextester/.buildozer/android/platform/build/build/other_builds/python3-libffi-openssl-sqlite3/armeabi-v7a__ndk_target_21/python3/Lib/threading.py", line 865, in run
04-29 15:11:45.105 27494 27585 I python : File "/home/alexandrumarcel/projects/kivy-apps/rextester/.buildozer/android/app/main.py", line 117, in execute
04-29 15:11:45.105 27494 27585 I python : File "jnius/jnius_export_class.pxi", line 742, in jnius.jnius.JavaMethod.__call__
04-29 15:11:45.105 27494 27585 I python : jnius.jnius.JavaException: Invalid call, number of argument mismatch, got 1 need 4
Я попытался добавить несколько значений (vibrator.vibrate(0, 400, 200, 300)
, но возникла другая ошибка:
04-29 15:21:19.065 27996 28101 F .rextesterdroi: java_vm_ext.cc:542] native: #10 pc 00036b4f /data/data/demo.org.rextesterdroid/files/app/_python_bundle/site-packages/jnius/jnius.so (???)
04-29 15:21:19.308 27996 28101 F .rextesterdroi: runtime.cc:558] native: #15 pc 00036b4f /data/data/demo.org.rextesterdroid/files/app/_python_bundle/site-packages/jnius/jnius.so (???)
04-29 15:21:19.311 27996 28101 F .rextesterdroi: runtime.cc:558] native: #04 pc 0000eb24 /data/data/demo.org.rextesterdroid/files/app/_python_bundle/modules/_ctypes.cpython-37m.so (_ctypes_callproc+728)
04-29 15:21:19.311 27996 28101 F .rextesterdroi: runtime.cc:558] native: #13 pc 00036b4f /data/data/demo.org.rextesterdroid/files/app/_python_bundle/site-packages/jnius/jnius.so (???)
04-29 15:21:19.311 27996 28101 F .rextesterdroi: runtime.cc:566] native: #10 pc 00036b4f /data/data/demo.org.rextesterdroid/files/app/_python_bundle/site-packages/jnius/jnius.so (???)
04-29 15:21:19.595 28105 28105 I crash_dump32: type=1400 audit(0.0:355029): avc: denied { open } for path="/data/data/demo.org.rextesterdroid/files/app/_python_bundle/site-packages/jnius/jnius.so" dev="mmcblk0p60" ino=2363865 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file permissive=1
04-29 15:21:19.595 28105 28105 I crash_dump32: type=1400 audit(0.0:355030): avc: denied { getattr } for path="/data/data/demo.org.rextesterdroid/files/app/_python_bundle/site-packages/jnius/jnius.so" dev="mmcblk0p60" ino=2363865 scontext=u:r:crash_dump:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file permissive=1
04-29 15:21:19.603 28105 28105 F DEBUG : #10 pc 00036b4f /data/data/demo.org.rextesterdroid/files/app/_python_bundle/site-packages/jnius/jnius.so
from jnius import autoclass
PythonActivity = autoclass('org.kivy.android.PythonActivity')
Context = autoclass('android.content.Context')
activity = PythonActivity.mActivity
vibrator = activity.getSystemService(Context.VIBRATOR_SERVICE)