Skip to content
Branch: master
Find file History

MetaWear Android Starter

This project is a stripped down version of the MetaWear Android app that provides a template for creating a MetaWear Android app. The provided code handles Bluetooth scanning and maintaining an connection to the board; all users need to do is add their own UI elements and setup their board with the MetaWear API.


User additions will mostly be added to the DeviceSetupActivityFragment class and the fragment_device_setup.xml layout file. In the DeviceSetupActivityFragment class, users can use the reconnected function to be alerted of when connection is re-established.

The next section provides a simple example that shows how to add a switch that controls the LED using this app template.

LED Switch

In the fragment_device_setup.xml layout file, add a switch to turn on/off the LED.

        android:checked="false" />

Then, override onViewCreated to have the switch control the led with an OnCheckChangedListener class:

public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ((Switch) view.findViewById(, isChecked) -> {
        Led led= metawear.getModule(Led.class);
        if (isChecked) {
            led.editPattern(Led.Color.BLUE, Led.PatternPreset.SOLID)
        } else {

After making your code changes, load the app on your phone and use the switch to turn on/off the LED.

You can’t perform that action at this time.