This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

OTA-DFU packaged into a Unity Application

Hi There,

I was wondering if anyone had any insight into whether the OTA-DFU (Android/iOS) LIbraries can be integrated into a Unity application? Is it possible to combine them into a plugin to do updates from within an application?

Thanks and best,

Dylan

Parents
  • That is a very interesting question, even though we haven't done that personally, it is indeed very possible to implement it in Unity3D players.

    Unity3d does support communicating with native code and send messages back and forth between your GameObjects and your native classes.

    To do that as a plugin or by manually extending the unity player is up to you, but both are doable.

    take a look at iOS for example, you'll basically need to set a scene that contains a game object that will handle the DFU process. it'll have a method to start the DFU Process, a method to receive progress updates and a method to be called upon completion.

    When you build your project, you'll be building an XCode project, you'll then import our iOSDFULibrary 'available as a Cocoapod or Carthage' into that project as you would with any other project, create your implementation class there that will handle the DFU Process and then create a static method to be called by Unity (Using the GameObject's script that you created earlier), once this is fired, our library will run as normal and flash your peripheral, when setting the delegates you'll simply forward the delegate messages to the unity GameObject that will be handling the callbacks.

    for android it's pretty similar, instead you'll generate an Eclipse project instead of an APK, then using the same GameObject class that you have you'll import our DFU library for android from JCenter 'no.nordicsemi.android:dfu:1.0.3' and add a new activity to your manifest that will be able to do similar communication from the native library to your GameObject.

    it is a bit of a tricky process but it is surely doable, here are some references:

    Native iOS Plugins

    Native Android Plugins

    if you have more questions please let us know !

  • This is such a well written reply. I assume this is the same process for even just using the bluetooth stack? I am just getting started and any advice on integrating into my game is very welcome. I have a few sensors and leds and I want to be able to read them in my game and fire the LEDs from there. Thanks in advance for any other infos. 

Reply Children
No Data
Related