• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Unity_Android Bluetooth Plugin

Huzyfee

Lurker
Hi Everyone!!

So, after taking deep dig at Android Plugins for unity, I understand its not easy task.

Task: I want to make a application in unity which on run time open Android bluetooth connect with a particular hardware and start getting data serially.

Things I understand: I need to write a java plugin using Android Studio, call the Java functions from C# to open/close/send/receive the data.

Now ISSUES!!: I have written a code in Java to connect with Hardware and get the data and displays on Mobile screen via Bluetooth. The code is totally working as a Application but when I try to convert it as a Library it just doesn't work. I am not able to get access the data using Unity application. Please any pointers to getting started with or how to pursue it would be really appreciated.

I have attached my working Android Project which turns the bluetooth ON and show the incoming data on Screen from hardware. In my case I was sending Potentiometer data using Arduino.

https://drive.google.com/file/d/0B3MI9RNDYypwbENPd21oTUlzUWs/view?usp=sharing

Please any help is appreciated.

Best Regards,
Huzaifa
 
I've not used Unity, but it's possible to call Android plugins from your C# code. Have you looked at this?

https://docs.unity3d.com/Manual/PluginsForAndroid.html

It even provides a whole sample project, calling an Android plugin library. Maybe you could look at the code, and it will give you an idea where you're going wrong?
 
I've not used Unity, but it's possible to call Android plugins from your C# code. Have you looked at this?

https://docs.unity3d.com/Manual/PluginsForAndroid.html

It even provides a whole sample project, calling an Android plugin library. Maybe you could look at the code, and it will give you an idea where you're going wrong?
yes I have looked into it. but the documentation is not very helpful. I was able to call functions from the android plugin through c# but when I start writing my bluetooth code into library and then try to call it .. this is just driving me crazy.
the problem I am facing right now is when I was using android studio I was even unable to toast whereas after using ant for making android library I am able to toast.. and but when using ant I am unable to include v7 app compat library.
 
Back
Top Bottom