bhaptics / tact-android

Other
1 stars 3 forks source link

Unable to make motors vibrate #5

Closed michaeltheory closed 3 years ago

michaeltheory commented 3 years ago

Hello! I have integrated the newest SDK and got my vest pairing correctly. However, whether I ping or use submitPath the motors never actually vibrate.

Weirdly, I also have this error when pairing. I wonder if it's related? 2021-05-06 22:55:39.290 13350-13350/net.activetheory.echotour E/bhaptics_log(1.15)PairedDevic: IO Exception: /storage/emulated/0/bhaptics/paired.json: open failed: EACCES (Permission denied) java.io.FileNotFoundException: /storage/emulated/0/bhaptics/paired.json: open failed: EACCES (Permission denied) at libcore.io.IoBridge.open(IoBridge.java:492) at java.io.FileOutputStream.<init>(FileOutputStream.java:236) at java.io.FileOutputStream.<init>(FileOutputStream.java:186) at com.bhaptics.ble.PairedDeviceManagerImpl.writeToFile(PairedDeviceManagerImpl.java:147) at com.bhaptics.ble.PairedDeviceManagerImpl.add(PairedDeviceManagerImpl.java:48) at com.bhaptics.bhapticsmanger.BhapticsManagerImpl.pair(BhapticsManagerImpl.java:470) at net.activetheory.echotour.Haptics$initBHaptics$1.onDeviceUpdate(Haptics.kt:112) at com.bhaptics.bhapticsmanger.BhapticsManagerImpl.notifyDevicesChange(BhapticsManagerImpl.java:604) at com.bhaptics.bhapticsmanger.BhapticsManagerImpl.access$700(BhapticsManagerImpl.java:38) at com.bhaptics.bhapticsmanger.BhapticsManagerImpl$3.onScan(BhapticsManagerImpl.java:137) at com.bhaptics.ble.BluetoothScanModule.onDeviceScanned(BluetoothScanModule.java:131) at com.bhaptics.ble.BluetoothScanModule$1.onScanResult(BluetoothScanModule.java:98) at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run(BluetoothLeScanner.java:504) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:250) at android.app.ActivityThread.main(ActivityThread.java:7766) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958) Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:166) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254) at libcore.io.ForwardingOs.open(ForwardingOs.java:166) at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7648) at libcore.io.IoBridge.open(IoBridge.java:478) at java.io.FileOutputStream.<init>(FileOutputStream.java:236)  at java.io.FileOutputStream.<init>(FileOutputStream.java:186)  at com.bhaptics.ble.PairedDeviceManagerImpl.writeToFile(PairedDeviceManagerImpl.java:147)  at com.bhaptics.ble.PairedDeviceManagerImpl.add(PairedDeviceManagerImpl.java:48)  at com.bhaptics.bhapticsmanger.BhapticsManagerImpl.pair(BhapticsManagerImpl.java:470)  at net.activetheory.echotour.Haptics$initBHaptics$1.onDeviceUpdate(Haptics.kt:112)  at com.bhaptics.bhapticsmanger.BhapticsManagerImpl.notifyDevicesChange(BhapticsManagerImpl.java:604)  at com.bhaptics.bhapticsmanger.BhapticsManagerImpl.access$700(BhapticsManagerImpl.java:38)  at com.bhaptics.bhapticsmanger.BhapticsManagerImpl$3.onScan(BhapticsManagerImpl.java:137)  at com.bhaptics.ble.BluetoothScanModule.onDeviceScanned(BluetoothScanModule.java:131)  at com.bhaptics.ble.BluetoothScanModule$1.onScanResult(BluetoothScanModule.java:98)  at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run(BluetoothLeScanner.java:504)  at android.os.Handler.handleCallback(Handler.java:938)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loop(Looper.java:250)  at android.app.ActivityThread.main(ActivityThread.java:7766)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958) 

I verify permissions first arrayOf(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE),

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
westside commented 3 years ago

This issue is related to this one. https://programmerah.com/android-10-open-file-exception-open-failed-eacces-permission-denied-androidrequestlegacyexternalstorage-true-358/

android:requestLegacyExternalStorage="true"

We are going to fix this soon without this option.

michaeltheory commented 3 years ago

Thank you for the response. I added

android:requestLegacyExternalStorage="true"

to AndroidManifest.xml under application but the error persists and the vest does not vibrate

michaeltheory commented 3 years ago

I am using Android 11 if that is helpful

westside commented 3 years ago

I'll check soon!

westside commented 3 years ago

We updated our sdk and you can check our latest aar files here. https://github.com/bhaptics/tact-android/releases/tag/v1.19

westside commented 3 years ago

you don't need to use these file permissions anymore

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>