How do we return data from sensor readings?

public static void gyroscope(MetaWearBoard metaWearBoard) {

    final GyroBmi160 gyroBmi160 = metaWearBoard.getModule(GyroBmi160.class);
    '''gyroBmi160.angularVelocity().addRouteAsync(source ->
   (data, env) ->
                Log.i("Gyro", data.value(AngularVelocity.class).toString());
            })).continueWith((Continuation<Route, Void>) task -> {
        return null;


How can i return the '''data.value(AngularVelocity.class).toString())''' back to an object? We want to put it into an sqllite database but I am not sure how to store it. Any suggestions?


  • Don't convert the object to a string.

  • Ok so i found the downloadasync method. I was wondering how I use it. Here is my code
    view.findViewById( View.OnClickListener() {

            public void onClick(View v) {
                final Logging logging = metawear.getModule(Logging.class);
                     // download log data and send 100 progress updates during the download
                        logging.downloadAsync(100, new Logging.LogDownloadUpdateHandler() {
                            public void receivedUpdate(long nEntriesLeft, long totalEntries) {
                                Log.i("MainActivity", "Progress Update = " + nEntriesLeft + "/" + totalEntries);
                        }).continueWithTask(new Continuation<Void, Task<Void>>() {
                            public Task<Void> then(Task<Void> task) throws Exception {
                                Log.i("MainActivity", "Download completed");
                                return task;

    When I try to do anything I either get null or bolts.task. I was wondering how to parse it or make it into something usable. What is your suggestion?


  • Again, wrap your code with backticks (```) and edit your post if it the text does not render correctly.

    I'm confused as to what you are asking now. First, you use code for streaming, now you are bringing logging code. Which one are you using?

  • Well i am trying to find the easiest way to download the data from the sensor and put it into a database. I am not sure how to get the data and put it there. I'm sorry about 2 different code blocks. My question would be how can i use the data from the logger after it is downloaded? I know it is put into a task object. How can I access the data in that task object?

  • Data handling is setup with routes:

    The sample code prints it to Logcat, so adapt it to do what you want to do with the data.

Sign In or Register to comment.