edited October 2017 in Android

can someone help me understand how to use the logging module? 
I have configured my MetaWear R board to log SensorFusion.quaternion  when the user click the button. The logging is stopped when the user click the button the second time.  This seems to work. The next thing I want to achieve is to download the logged data. I have implemented this using the example in the documentation:

public void downloadLoggedData() {
// download log data and send 100 progress updates during the download
loggingModule.downloadAsync(100, new Logging.LogDownloadUpdateHandler() {
public void receivedUpdate(long nEntriesLeft, long totalEntries) {
Log.i("MainActivity", "Download 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 null;
I see that data is being downloaded since the LogDownloadUpdateHandler outputs the number of entries. However I do not understand how I am going to get a hold of the data? My Subscriber.apply() does not output anything and the task.getResult returns null?

I am new to the Bolts framework so please bear with me.



  • I am able to fetch the data through the subscriber as long as I do not restart the application. Should I save the session to the board in some way after configuring the board to log data when clicking the onboard button?

  • Thanks. This works for persisting the data when doing both streaming and logging data. However when I log data, it seems like my Subscriber is "lost" when I reconnect the board or restart the app. Before a reconnect I see both the Download progress and the data in the console, however after a reconnect I only see the download progress. Any suggestion on what I am doing wrong?

     ***The Subscriber works after restarting the app when I use source.stream instead of source.log***
  • Post the MetaWear code you are currently running.
  • The code:https://pastebin.com/Bgps926n 

    The connection and configuration of the board starts when the user selects a board in the GuI and the following callback is called:
    onBleDeviceSelected(String deviceAddress)
  • edited October 2017
    I don't see any calls to serialize or deserialize in your code.  Also, a subscriber's environment should be set when you're ready to download the data.

    Modify your code so it follows these flows for setup and download:
    1. Add routes for your sensors
    2. Serialize board state
    3. Start logging
    1. Stop logging
    2. Deserialize board state
    3. Set environment for the subscribers
    4. Start log download
This discussion has been closed.