Closed PedroLopes closed 6 years ago
Hi Pedro, I can't test it right now because I recently changed place where I live and I don't have the ble mini and arduino with me. I see that my latest commit on the project says "Everything works on Android except the fact that data is not transmitted correctly". I am sorry to say, I wasn't able to solve the problem because by knowledge of Android architecture is limited compared to the one of iOS I have. If you are able to solve the problem you are welcome to submit a pull request in github, please.
Thank you for your time,
Giovanni
On Sun, Jul 10, 2016 at 6:45 PM, Pedro Lopes notifications@github.com wrote:
Everything works, i.e., I can connect the phone (running your code in Unity, on an android) and my arduino which has a BT LE module. (I see the blue LED that signifies the connection worked).
However, the function _SendData, crashes in runtime with: 07-10 18:38:28.493 4294-4318/? I/Unity: AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGattCharacteristic.setValue(byte[])' on a null object reference java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGattCharacteristic.setValue(byte[])' on a null object reference at com.gmurru.bleframework.BleFramework._SendData(BleFramework.java:605) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.a(Unknown Source) at com.unity3d.player.UnityPlayer$b.run(Unknown Source) at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJNISafe.CallVoidMethod (IntPtr obj, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in
:0 at UnityEngine.AndroidJavaObject._Call (System.String methodName, System.Object[] args) [0x00000] in :0 at UnityEngine.AndroidJavaObject.Call (System.String methodName, System.O Is this the proper way to send a few bytes through the BT connection? Do I have to initialize a service first? (I do that in my Android Studio app, was trying to replicate in Unity)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/giomurru/ble-framework/issues/1, or mute the thread https://github.com/notifications/unsubscribe/ACr6QC7RAFCrH-JYTBUVwJfftZrVoFPMks5qUSG3gaJpZM4JI3sa .
Is this issue solved as of now?
Is this issue solved ? It wouldn.t work right now?
Please note that the issue was because of wrong UUID in .jar file. My android developer friend changed the UUID in .jar file and it is working fine now.
Apart from .jar file, great plugin. Thanks Giovanni!
@akainth can you please explain how did you solve the problem in the code that generates the jar? What UUID did you change? Thank you.
I'm working on the problem on the branch android-fix-dev. I switched to Android Studio build, so please ignore the instructions about ant. Furthermore Unity project already include the compiled jar android plugin and is ready to use. Unfortunately not everything is working. You are welcome to contribute in the Android Plugin Project if you have any fix.
Is there anybody who could solve the issue? I am having the same issue now. I need help about this problem
Yes please, I'm stuck on the same issue as well, with android!
Is there any people who could solve this issue already? Please help me!!!!:((
Everything works, i.e., I can connect the phone (running your code in Unity, on an android) and my arduino which has a BT LE module. (I see the blue LED that signifies the connection worked).
However, the function _SendData, crashes in runtime with:
07-10 18:38:28.493 4294-4318/? I/Unity: AndroidJavaException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGattCharacteristic.setValue(byte[])' on a null object reference java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothGattCharacteristic.setValue(byte[])' on a null object reference at com.gmurru.bleframework.BleFramework._SendData(BleFramework.java:605) at com.unity3d.player.UnityPlayer.nativeRender(Native Method) at com.unity3d.player.UnityPlayer.a(Unknown Source) at com.unity3d.player.UnityPlayer$b.run(Unknown Source) at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJNISafe.CallVoidMethod (IntPtr obj, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJavaObject._Call (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0 at UnityEngine.AndroidJavaObject.Call (System.String methodName, System.O
Is this the proper way to send a few bytes through the BT connection? Do I have to initialize a service first? (I do that in my Android Studio app, was trying to replicate in Unity)