-
Notifications
You must be signed in to change notification settings - Fork 31
6.4 Flyver Logger
The Flyver SDK offers configurable logging of any data which the user wants safely stored. It relies on two components - the logger library in the FlyVer SDK, which stores data locally on the phone, and an online server, which accepts data from the library, stores it as well and visualizes it.
The server application runs on Web2Py.
To use the logging feature you need to:
- register for free at the server at http://logger.flyver.co/register
- create a token at http://logger.flyver.co/tokens
- store that token via the dataloggerlib's Activities
Then just instantiate the logger, passing a Context to it, so it can load its settings, then start it and fire events away :)
LoggerService logger = new LoggerService(this.getApplicationContext());
logger.Start();
logger.LogData("event type", "some tags", "some long data goes in here");
logger.Stop();
Please note that all data is also stored locally, which you can review via the LocalDataActivity Activity, or use the LoggerService methods:
StringBuilder sb = new StringBuilder();
SimpleEvent se;
LoggerService logger = new LoggerService(this.getApplicationContext());
logger.LocalReadFromStart();
for (int iCount = 0; iCount < 100; iCount++) {
se = logger.LocalReadLogEntry();
sb.append("Type: " + se.EventType + "\n" +
"Tags: " + se.EventTags + "\n" +
"Data: " + se.EventData + "\n" +
"Timestamp: " + se.EventTimeStamp + "\n");
}
// Seek to the end of the file so that new entries are properly recorded
logger.LocalGoToEnd();
logger.Dispose();
Each entry is stored locally as a base64-serialized SimpleEvent object, and each record is prefixed with its length in bytes.
For more details just delve into the code.
If you believe this page needs to contain more information then just contact us.