Robot-Scouter
Robot-Scouter copied to clipboard
Auto Scout – Phase 1
This phase adds core backend infrastructure to support Auto Scout.
Requirements
- Device identification
- Device naming
- Remote wake-up triggers
- Master vs. slave differentiation
Identification
FirebaseInstanceId.getInstance().id
Wake-up
Setup FCM to log incoming messages and errors.
Create Cloud Function to add device to group. Check for notification key. If null, create the device group, else add the device. notification_key_name
== ${uid}
.
In an auth listener, if isFullUser
, trigger the cloud function if the cache/db/device-id.json
file doesn't exist.
Database
{
"users": {
"uid": { // Document
// …
"groupId": "notification_key",
"devices": { // Collection
"instanceId1": { // Document
"name": "...",
"token": "registration_id"
},
// ...
},
"prefs": {
// …
"master": { // Document
"value": "instanceId1"
}
}
}
}
}