Google Fit get records with history (updates) - cordova-plugins

Is it possible to get the DataPoints with history like last update date/creation data and original/updated value?
I need to get a user's weights, and sync them with my app, but, I need to know what records have been updated after I made the first get for a specific period (like last 01.01.2020 - 02.02.2020).
My app uses ionic and cordova with the health plugin, but that is not the point of my question. If needed I can write a new plugin to acces the fit data.
This is the existing plugin code to get the data: https://github.com/dariosalvi78/cordova-plugin-health/blob/master/src/android/HealthPlugin.java

It appears that you cannot get the history of the records.

Related

Getting last update information / Firebase

When working with a database on Firebase, is it possible from within an iOS app to check the date(& time) a document was last updated using some standard API? I mean without implementing my own system to know when it was last time touched.
It would be convenient if there was a field "lastUpdate" time-stamp for instance.
Neither the Firebase Realtime Database nor Cloud Firestore automatically adds a timestamp field to the data for writes.
If you want such a field, you will have to add it yourself, either from the client, or from Cloud Functions.
For a simple example of the latter, which tracks when a node in the database was last modified, see this folder in the functions-samples repo. The main code:
exports.touch = functions.database.ref('/chat/{message}').onWrite(
(change, context) => admin.database().ref('/lastmodified').set(context.timestamp));

Get new emails with microsoft graph

I am trying to get only new emails with microsoft graph.
Iam doing this by checking date like
GET https://graph.microsoft.com/v1.0/me/messages?$filter=receivedDateTime+gt+2016-06-06T08:08:08Z
Is there any possibility to build query to get new messages but base on id instead of receivedDateTime? Something like: get messeges until you find id=....?
I think the delta query solution is pretty good (as suggested in a different answer). However, for my purposes, there were two major drawbacks: 1) it's in preview (beta) right now, so it makes it less than ideal for production code and 2) it doesn't seem to support the monitoring of all messages, just those in a particular folder.
I actually prefer the solution you're working with. The timestamp in the header of the response can be used to reset the time field in you query, so that if you have "receivedDateTime gt 12:00:00" and get back the server time of 12:01:00 for your request, you can use "receivedDateTime gt 12:01:00" next time.
The scenario you're looking for is specifically what the new Delta query is designed to support. Deltas allow you to retrieve changes to a given folder (i.e. Inbox) since you last polled that folder. Message IDs not static or consecutive so they're not a suitable property for determining new vs. old messages.

Automatically remove entry from Firebase that is out of date

I have an iOS social app that uses Firebase as the main database to store all the posts with time stamp included
What I want to achieve is to remove anything that is > 10 days old from my database.
Currently, I am checking this with this super inefficient way (The only way I know). Every time the user queries the firebase, I have swift code that also queries the ENTIRE database and delete all entries that is > 10 days old. This works but it is really inefficient...
What you're trying to do is currently best done on a server you control with a job that runs periodically to scan and delete the old items. You can use the admin SDK for that.
You should also have a index on the time field that you're using to determine how old it is, in order to optimize the query that generates the results.

how to make flurry start gathering data at a certain date

Initially I had a single app registered with Flurry.. we used this app pre-launch for testing etc.. and flurry captured all the data from my testers etc. We have recently launched the app and basically made flurry only capture the data from live users (ie so that it doesn't get polluted by our testers actions).. is there a way to instruct flurry to erase or hide all the data it captured prelaunch and just show us the post launch data?
One of way of doing this is to select which version u're interested in looking at
the problem with this approach is that it only gives you stats for a single version..
another approach is to simply delete the versions that contains the polluted data.. this way you can go over the results of all the versions that have accurate data
Flurry recommends that you create two or more projects for each app. You can use one project for development and testing and another for the published version of your app. Just don't forget to swap the api key when you publish the app.
This also has the benefit of splitting your versions up so you do not approach the limit of 1000 versions per project.
Alternatively you can use the timeframe filter to remove data that precedes the publication date of your app.

CouchDB and iOS

I need some help with a CouchDB iOS project.
I'm using Apache CouchDB Server and the couchbase-lite iOS Framework.
On my CouchDB I have a template document.
- CouchDB Server
- database
- template
- document 1
- document 2
- ...
My goal is to only synchronise my iPad with this template document to get the latest data which my application needs.
But when I enter some data on my iPad, I want that this data should be pushed only to couchBase Server.
How can I "tell" my application to synchronise only one file and not the entire database with my server and at the end how can I "tell" my application to only push the data that is input from user side ?
More importantly, Do I need two databases on my server? One for the template and a second one for user input data?
If YES, then I just need to know how I can only push my data.
Guidance needed. Thanks.
This is how I solve this:
I tend to add a 'last update' date to all my documents, and store this in a format that means they'll be sorted in time order (epoch or yyymmddhhmmss) both do.
Create a view that uses the update time as a date.
On your client, store the time since you last updated.
When you update, access the view with a startkey parameter set to the last update date.
You can then either use 'include-docs=true' to get the documents as you query the view.
I tend to use 'include-docs=false' though as it means when a lot of documents have been updated I transfer less data in a single query. I then just directly access each document id that the view returns.

Resources