APP Template can't find my CPRO

edited August 2016 in Android

I used the Android App Template to connect my Nexus 5X with my CPro but if I click "scan" no device is found, after I manually told the App the mac adress of my board it finally connects. I am new to Android programming and I can't find the code lines where the mac adress is read, because I want to enter a static adress, so that the app only can connect with my board?
Another problem is, to find the xml code, which sets the "MetaWear Android Starter" Headline in the layout?

edit: The MetaWear App from the App store can't find the board either, but in the past it worked, I don't know what happened!? 



  • Sounds like location permissions are disabled for the app.  You can manually enable that specific permission from the app settings page.

    Follow this thread on SO for changing the app name.
  • The app got the location permission but it doesn't work, I already updated the App and the Firmware to the latet version but the problem still exsists.

    Thanks, I changed the app name and the headline! 

    btw: Has anyone informations about how to recongnize and count steps, I can't find alot about that?! 

  • Can other apps, like the nRF Connect app find the board with a scan?

    Have you checked the documentation?
  • The app had location permissions, but the location service on the smartphone in general was disabled....sorry, my fault.

    I already checked the documentation and copied the configureStepDetection part in the ready() function and the other code in an onClick listener for a start button, is that correct or do I have to call the readStep Counter periodically? The .setMode generates a "cannot resolve method" error?!

    public void ready() {
    try {
    accModule = mwBoard.getModule(Bmi160Accelerometer.class);

    } catch (UnsupportedModuleException e) {

    while accModule is delcared as: 
    public Bmi160Accelerometer accModule;
    in the DeviceSetupActivityFragment class.

    I am doing this for a university project and the focus is on the step detection, 
    therefor ist is better to use my own alogrithm ;) But the information I found are
    very rare. I thought about a neural net for pattern recogniton (walking, standing,...)
    and if it detects walking or running I'll count the peaks of the absolute value of the 3 axis acceleration to get the steps or something like that.
    I am sorry for asking those stupid things, but in the past I only worked with Matlab or C code so this is very new for me and I am running out of time for my project....

  • Yes, you need to call readStepCounter periodically.

    Looks like the documentation has the wrong code, it should be setSensitivity.  

    Most step counters probably just compute rms/rss of the acceleration data, accumulate the values over a period of time, then convert the sum into a step count if said sum is above a certain threshold.
  • I also forgot the acceModule.start(); but I got the next problem :(

    I also want to display the step count in a textview in the UI but I'm not sure, how to use the .setText(). 
    The XML file contains a textView with the ID "stepView", in the MainActivity, in the connectionstatehandler function I'm calling the ready() function

     public void ready() {
    try {
    stepModule = mwBoard.getModule(Bmi160Accelerometer.class);

    // Set sensitivity to normal
    // Enable step counter

    .onComplete(new CompletionHandler<RouteManager>() {
    public void success(RouteManager result) {
    result.subscribe("step_counter", new RouteManager.MessageHandler() {
    public void process(Message msg) {
    Log.i("MainActivity", "Steps= " + msg.getData(Integer.class));

    // runOnUiThread(new Runnable(string.msg.getData(Integer.class)) {
    // @Override
    // public void run() {
    // Toast.makeText(getApplicationContext(), R.string.toast_connected, Toast.LENGTH_SHORT).show();
    // TextView counted_steps = (TextView) findViewById(;
    counted_steps.setText("Steps: " + msg.getData(Integer.class));
    // }
    // }
    // );



    } catch (UnsupportedModuleException e){


    but how do I have to use the runOnUiThread function to display the steps in the UI? 
    counted_steps = (TextView) findViewById(; can be found in the onCreate
  • Check out this thread from Stack Overflow for example code
This discussion has been closed.