Here are the steps needed to connect to the Milicom BLE PTT button and receive notifications.

  1. Import the MilicomBLE module into your Android Studio project.
    Displaying Step1.png– File – New – Import Module
  2. Add the dependency for the new module.
    – In the build.grade where you want to use the module you will need to add compile project(‘:milicomble’)
  3. Add these two lines to the file where you would like to call the MilicomBLE module to import the files needed.
  4. Create a MilicomBluetoothService object.
  5. Implement the MilicomBluetoothListener interface and all of the methods within MilicomBluetoothListener. This can be done in a new class or in the activity where you need the MilicomBluetoothService.
    – New Class Way

    – In the activity where you need the MilicomBluetoothService


  6. Initialize the MilicomBluetoothService by passing it a context as the first parameter and a MilicomBluetoothListener object as the second parameter.
  7. No filters are needed, but you can add any number of name filters and mac address filters to the MilicomBluetoothService that it will filter by when it searches for BLE devices.  The name of the BLE device that it is searching for will have to contain all of the substrings that you add using bluetoothService.AddNameFilter(), and as long as the BLE device that you are searching for is one of the MAC address filters that you added, it will get found.  You can add the filters like so.
  8. After you add all of your filters, you will then be able to search for any devices in the area.
  9. Found devices will be returned in the onDeviceFound(BluetoothDevice _btDeevice) callback function within the MilicomBluetoothListener object.  This could return duplicates so make sure you handle that.
  10. You can then connect to a device by calling blueoothService.ConnectToDevice(BluetoothDevice _deviceToConnectTo); and passing it the device that you want to connect to.
  11. You can also disconnect from any currently connected device by calling bluetoothService.DisconnectFromDevice();.
  12. Notifications will be returned through the onCharacteristicNotification(final BluetoothGattCharacteristic _characteristic) callback function within the MilicomBluetoothListener object.  In the case of this specific MilicomPTT button, the object is a string in memory. So when you get the object back you will have to get the string value of it.  Like below.
    api013The UUIDs for the UART characteristics are in the file, I think these are a standard and will be the same regardless of the device.api014

To download the Android Studio API/module, and the file on this page:
Enter your name and email address here.  You will receive an email including the download link.

Your Name (required)

Your Email (required)