Download Log after re-connecting

edited February 2017 in Android
Hi,
I have implemented the Free Fall Tutorial, with a change, I've added a button to download the log, separated from the stop logging button, and I don't understand why I can't download the log if I have reconnected with the board, Example:

I connect with the board, click start logging, then i click back on the phone, re-open the app, re-connect with the board, and then click the download button.

In this case, the download is empty.
I'm missing something, someone can help me?

Thanks.

Edit: I have another question: Can you limit the metaboard to connect it with only one mobile phone? So if I connect my mobile to the metaboard, configure it so other mobile phone can't connect with it in the future.

Comments

  • Closing the app destroys API state; you need to serialize the state before closing the app and restore it prior to downloading the data.

    Checkout the example from this blog post:
  • Thanks for the answer! I'll check that link.

    And what about the other question: "Can you limit the metaboard to connect it with only one mobile phone? So if I connect my mobile to the metaboard, configure it so other mobile phone can't connect with it in the future."

    Thanks!
  • edited February 2017
    No, any device can connect to the board once it is advertising.
  • Ok, so I'm doing some tests with two mobile phones. When I connect the second mobile phone, it can download all the data of the memory, being "unknown" or "unhandled" entries, and this data is erased from the memory of the board. So if I connect the first mobile again and try to download that data, it downloads nothing. How can I restore that data with the first mobile phone? Can I download the data without erasing it from the memory? How can I secure the data from "unauthorized" connections to the board?
  • No, once downloaded, the data is cleared from the flash memory.

    You can't prevent unauthorized connections.  However, it is highly unlikely that someone will go around doing log downloads from the boards to prevent you from retrieving your data.  If you are that paranoid about this scenario, then you can set an ad timeout so the boards will only advertise for a small window though this means you will need to manually restart the ble advertising so you yourself can connect to them again.
This discussion has been closed.