Flutter Push Notifications Integration

Job ID: 39369890

Budget: £250 – £750 GBP

Create a Flutter app to capture motion changes
Skills: Flutter and Android Notifications via Firebase
Use Flutter 3.29.2 or earlier

Scenarios:
User starts walking - a record is added to eventsList
User starts running - a record is added to eventsList
User stops - a record is added to eventsList
A button will allow you to trigger (simulate) a transition for demo Stay->Walk->Run->Stay.
User click “Clear” to empty the eventsList and continue
User click “Stop” to stop reading from sensors. The home screen widget reflects this option.
User click “Start” to resume reading from sensors. Same for the home screen widget
User can click “Save” to save the current eventsList. On save will be asked to name the list. User can navigate to the second page (“History” button) and back to the main page (“Back” button)
On the History Page user can delete a eventsList the list of items. With confirmation.




The accelerometer and GPS is used to determine user changes between Stand / Walk / Run.
Does not have to be accurate or scientific. Use any thresholds you want.


The app will have 2 pages and one widget.
Will use
- Flutter (Android)
- SQL-lite for persistence between sessions and offline access.
- Firebase for Notifications


Will use a GPS service to read the GPS stats if the useGps is enabled.
Will run in background if the allowRunInBackground is enabled.


gpsService {
bool useGps = true
}


=== Main Page ===


The main window contains
- A disclaimer area containing a text reading "This app is using your location" and checkbox labeled "I agree". When "I agree" is clicked, the disclaimer disappears. On restart the disclaimer area only shows if was not previously agreed.


- A label showing the user state as "You Stand", "You Walk", "You Run" based on appLogicService.userState.


appLogicService{
userState = "Stand" | "Walk" | "Run"
allowRunInBackground = true | false
useGps = true | false
lastEventTimestamp = time of last event or 0
lastAccelerometerValues = the values when the last event was added to the eventsList
}


- An icon showing one of the states "Stand", "Walk", "Run" (use any 3 icons - they will be replaced anyway). This icon changes according to the logic in the AppLogicService (see later).


- The last GPS reading if appLogicService.useGps otherwise show "GPS not enabled"


- The last accelerometer data.


- A list bound to the eventsList. Click on items has no effect. The list is scrollable. Below the list there is a link to http://google.com This link is always visible on this page and is on a fixed position, always 10px above the bottom of the page regardless of the content of the list or other elements on the app.


- A button to switch the allowRunInBackground flag. The label of this button is "Start" or "Stop"
When "Start" is click, show a modal with the following content:
- A text reading "This app is using your location" and checkbox labeled "I agree"
- When "I agree" is pressed the modal remains open. The modal has a "Close" button to close the modal. Set the appLogicService.lastEventTimestamp to current time.
When "Stop" is click, show a modal with the following content:
- A text reading "Are you sure" and "Yes" "No" buttons. On "Yes" set the appIsRunning to false. In both cases close the modal.


- "Allow GPS access" if useGps == false. When is clicked show a modal with the following content:
- A text reading "This app is using your GPS" and checkbox labeled "I agree"
- When "I agree" is pressed the useGps is set to true and the modal closes. User will now see the "Stop using GPS".
- "Stop using GPS" if useGps == true. When is clicked show a modal with the following content:
- A text reading "Are you sure" and "Yes" "No" buttons. On "Yes" set the useGps to false. In both cases close the modal. Switch to "Allow GPS access" if needed.


AppLogicService
- Use accelerometer to dynamically switch between "Stand", "Walk", "Run". Set any treshould you like, no need to be accurate.
- On each switch add a record to the eventsList and a notification is sent via firebase. The record will have this form:
{
lastEventTimestamp = appLogicService.lastEventTimestamp,
currentEventTimestamp = the current time
gpsLatitude = 0 if GPS is not enabled
gpsLongitude = 0 if GPS is not enabled
currentAccelerometerValues = reading from accelerometer
}
Then set the appLogicService.lastEventTimestamp to current time. And the appLogicService.lastAccelerometerValues to the current values.




=== Second Page is History Page ===


The second window contains:
- A button "Back" to go back the main page


- A list of items where each item is linked to a eventsList:
{
creationTimestamp: The timestamp of the creation
eventsList: the list of events
name: can be null
isDeleted: false
}


Click on an item will open a modal window with the following content:
- A button "Delete". If clicked will ask "Are you sure?" And will delete the item on "Yes".
- the item name if it exists. User should be able to edit the name.
- The date and time when this was saved (creationTimestamp).
- A "Sync now" button that does nothing.


=== Home Screen Widget ====


The screen widget will use home_widget on Android


- An icon showing one of the states "Stand", "Walk", "Run" (use any 3 icons - they will be replaced anyway). This icon changes according to the logic in the AppLogicService (see later).


- The last accelerometer data (velocity).


- A label "GPS" shows the GPS status by color: appLogicService.useGps ? black : gray
- An icon shows if app is running: appLogicService.allowRunInBackground ? Icon1 : Icon2


=== Android Notification ====
Use firebase to send notifications to other devices.
The notification will have the same icon as the item added to the eventsList.
Will also contain the state text as "User state: Stand", "User state: Walk", "User state: Run", and the short time like 14:23 pm
Related categories: Android Push Notification Flutter