

Ask HN: Mobile Data: On-Device Only or Remote API? - scribbles

A while back I was working on building a fairly simple app that lets me track some different aspects of my workouts. I know, there are 1000 apps out there that track workouts so this was more of just a fun thing to build :)<p>Now that I&#x27;ve got it on my phone and playing around with it I&#x27;ve had some requests from friends that they&#x27;d love to use it too, which leads me to my question.<p>When building for myself I didn&#x27;t really care about where the data was stored. If I deleted the app off my phone I wasn&#x27;t too worried if I couldn&#x27;t get it back. Now there will be more users and more data, does it make sense from your experience to create an API to store the data remotely? I see some pro&#x27;s and con&#x27;s to a remote API:<p>Pros
- Data Backups
- Sync across devices
- Easier analytics (via db lookups, though Google Analytics could be arguably easier...)
- Easier(ish) feature enhancement with a versioned API (just add some new api endpoints vs modifying the local DB)
- No local database, just a simple JSON API, ahh...<p>Cons
- Building an API :) That being said, it&#x27;s fairly simple setup with only a few models
- Users would have to register (so we could authenticate them via the API and get their data)
- Requires internet access
- Obviously slower than having data stored locally, though how much slower isn&#x27;t clear<p>So, what would you do? Would you rather the data be stored remotely or locally? Any experience that lead you to that conclusion that you wouldn&#x27;t mind sharing?
======
byoung2
I would store it remotely using an api, but cache it locally on the device.
Storing it remotely makes it easier on users when they switch devices or want
to view their data on a computer. You also get the option to send out alerts
(email and push notifications) if the data is on a server. There could be some
revenue possibilities there (sending out targeted offers for massage or
smoothies after workouts, etc). You can also play with analytics on the
workout data (e.g. if there are enough people, see how they compare to each
other, see activity level by location, etc).

You may be able to use a PaaS backend like Parse to power your API.

~~~
scribbles
I agree with just about every bit of that :) Thanks for the response! I think
this makes the most sense, remote with some sort of local caching. Leads to a
bit more implementation though and questions like:

1) What happens when they post something but don't have internet, would it
store locally then sync up when it can? Or, just not allow posting without
internet (curious how many people workout with an iPod Touch).

2) What happens when we get a new call from the remote server, kill the local
table entirely or have some field on each record like "synced" that lets you
check for records that need to be updated still?

Anyways, just a few things like that but thanks a ton, you gave me some more
things to think about :)

------
drl42
Another approach would be to use the Backup API's provided by Google/Apple.
[http://developer.android.com/guide/topics/data/backup.html](http://developer.android.com/guide/topics/data/backup.html)

~~~
gusmd
I second this. Don't know how it works for iOS, but for Android it is
straight-forward. And should be even more now with the new automatic backup
for Android M [0].

You would have people keep their data as they update devices, no need to build
an API, but would lose the analytics part that you mentioned.

[0]
[http://developer.android.com/preview/backup/index.html#overv...](http://developer.android.com/preview/backup/index.html#overview)

------
uberneo
You can easily create a backend free of cost on
[https://orchestrate.io/](https://orchestrate.io/)
[https://parse.com/](https://parse.com/)
[http://apifox.com/](http://apifox.com/)

