FirmwareUpdateActivity

This is the activity which will require DfuService class to upload the firmware. You will first need to implement a file chooser which will be responsible to pick the secure package for firmware. This can be achieved by including following package to your FirmwareUpdateActivity:

private static final int FIRMWARE_SELECT_CODE = 0;private void showFileChooser() {    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);    intent.setType("application/zip");    intent.addCategory(Intent.CATEGORY_OPENABLE);    try {    startActivityForResult(    Intent.createChooser(intent, "Select a File to Upload"),    FIRMWARE_SELECT_CODE);    } catch (android.content.ActivityNotFoundException ex) { // Potentially direct the user to the Market with a Dialog ...

Get Building Bluetooth Low Energy Systems now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.