This will be my first iOS app with any bit of complexity. I’d like to outline the components and structure to get some feedback before I dive into attempting it.
From the user’s perspective, the app monitors the water level of a local lake and receives push notifications when the water level changes a user-specified amount. I think using Parse will be easiest to manage user data and I will attempt a Node.js server-side component on Nodester (I know some basic JS and figure its an good up and coming language to get familiar with). Here’s how I see it working…
- The user creates an account on the device and specifies a
lakeLevelChangeamount in which they will receive a push notification. The user’s data is pushed to Parse’s data mgt. - The server side component will run this program 3-6 times a day:
- Pulls a
currentLakeLevelvia HTTP request - Pulls user data from Parse
- Compares the
currentLakeLevelto the user specifiedlakeLevelChange - If the difference is =>
lakeLevelChange, a push notification HTTP Post request is sent, per user which their specified condition is met
- Pulls a
- Parse receives POST request and sends a push notification to APNS server
- Client receives push notification
It actually doesn’t sound terribly complex when its typed out. Is this the proper way of structuring this functionality? Am I missing anything? Suggestions are greatly appreciated!
Bit of a logic problem:
You actually need to store the level at last alert for each user, too. Otherwise incremental changes could creep over your users’ threshhold and never trigger an alert.
Imagine if I said I want to be alerted when the level has changed by 6 inches. You then record seven events in which the level rises by an inch each time. At no point did you observe more than 6 inches of change, but the total change is over my threshold for notification, and I probably meant to have you notify me about that.
So when you fire an alert, you need to store the current level, and then on each change event, you compare that to the last level you notified them about.