OTA Updation Using Xamarin Failed Using BGM123 In Android Mobile Porject RRS feed

  • Question

  • User396745 posted

    I am developing a mobile application for one of our Bluetooth devices using Xamarin as a development tool. I have Successfully created the application and it works perfectly. Now we prefer a firmware update feature for this application. I can easily update the firmware(application.gbl) using the Wireless Gecko application. But my xamarin application does not work. Also, I am not familiar with android coding.

    These are the steps I done in my Xamarin code.

    1)Xamarin code successfully connected the Bluetooth device and communicated with the OTA service

    2) Then I write 0 to the OTA Control characteristics. It was successfully written and rebooted with the OTA mode(changed Bluetooth name to OTA in Bluetooth search list).

    3) Reconnect to the OTA device with my xamarin code. But it is showing only the OTA Control in the OTA service list, (Not listing the OTA Data, FW version, OTA version etc...). But all this is successfully working in the Blue Geck application.

    Here is my xamarin code

    For Blue tooth connection

    ``` public void ConnectAsync(string deviceID) { try { //IsConnected = false; this.isConnected = false; this.ConnectedDevice = null;

                //Searching in list obtained by scanning
                foreach (IDevice device in this.DiscoveredDevices)
                    //Checking the opted device is exist in latest scan
                    if (device.Id.ToString() == deviceID)
                        TimeSpan time = new TimeSpan(0, 0, 5); // hours, mins, secs
                        _cancellationTokenSource = new CancellationTokenSource(time);
                        //Initiate connection to deivice
                        this.bleAdapter.ConnectToKnownDeviceAsync(device.Id, default(ConnectParameters), _cancellationTokenSource.Token);
            catch (Exception ex)
                throw new Exception("Failed to connect device");


    Reading Service information

    ``` var service = await ConnectedDevice.GetServiceAsync(Guid.Parse(serviceuuid)); //OTA Service serviceCopyActive = service; IReadOnlyList list= await service.GetCharacteristicsAsync();


    The above list showing only the UUID of OTA control and unable to communicate with other UUIDs in the OTA service.

    Thursday, September 10, 2020 5:36 AM

All replies

  • User396745 posted

    Finally, I noticed my code works when I Off and On the mobile Bluetooth before reconnecting the same device.

    But not any effect when I restart the application only off and on the Bluetooth correcting the issue Why this happening, How I can solve this using my xamarin code?

    Thursday, September 10, 2020 12:53 PM