1. Download our Official Android App: Forums for Android!

Apps Unity_Android Bluetooth Plugin

Discussion in 'Android Development' started by Huzyfee, Aug 5, 2016.

  1. Huzyfee

    Huzyfee Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Aug 5, 2016

    Aug 5, 2016
    3
    0
    5
    Male
    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
     

    Advertisement

  2. Unforgiven

    Unforgiven OK Google
    Moderator
    Rank:
     #1
    Points:
    4,238
    Posts:
    35,926
    Joined:
    Jun 23, 2010

    Jun 23, 2010
    35,926
    41,308
    4,238
    Male
    Douglas, MA
    I think you will get better help here in the developer area. :)
     
  3. Huzyfee

    Huzyfee Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Aug 5, 2016

    Aug 5, 2016
    3
    0
    5
    Male
    please guide me as I am new to this forum. thanks :)
     
  4. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,292
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,292
    10,403
    1,988
    Male
    Software developer
    South West of England
    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?
     
  5. Huzyfee

    Huzyfee Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    3
    Joined:
    Aug 5, 2016

    Aug 5, 2016
    3
    0
    5
    Male
    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.
     

Share This Page

Loading...