This android app runs a background service that saves the device location, speed, direction and other measurements every 10 seconds to a google firestore database. The full location history is available for live or deferred analysis.
- Install Android Studio.
- Clone or download this repository.
- Create a Firebase account because data is saved there. The free account is sufficient. See console.firebase.google.com
- In Firebase create a project, for example "asset-tracker".
- Navigate to Develop / Database and open the Rules tab. Replace the contents with the content of the file
firestore.rules. Click publish. - Navigate to Authentication / Sign-in method and enable the Google sign-in provider.
- Navigate to
Project settings. There click on the android icon on the bottom.
- For Android package name enter "com.example.assettracker".
- For Debug signing certificate SHA-1, enter the debug certificate SHA1 key. The command to get it is documented here. The SHA1 key is needed for Google Sign-in.
- Click Register app and then click Download google-services.json.
- Copy the downloaded google-services.json to the /app folder.
- Open the project in Android Studio.
- Connect your android device with a usb cable.
- Developer mode must be enabled on your phone.
- Click Run or click Debug. The app will be compiled and be installed on your phone.
- The app will ask you to log-in with your google account. This is only required the first time the app starts. Even after a reboot you do not need to log-in again.
- A bus icon appears in the status bar to indicate that the service is running. Click it to stop the app.
To see the generated data, login to the firebase account (see above) then navigate to Database and open the Data tab. You can access the Google Firestore database from android, iPhone or a web app. Firestore can push data modifications to clients.
- A user must have a google account but different log-in methods can be activated.
- A user may generate measurement data for zero or more devices.
- A user can read data hat s/he generated.
- A user can read data from other users if the other users grant permission.
{userUid: "qDrkd0i898cjJhEo3MDJZaxe2gO",// Type stringemail: "test@gmail.com",// Type stringdisplayName: "Test User",// Type stringaccountCreatedAt: 2May2020at20:16:40UTC+2,// Type timestampauthorizedUsers: ["pBc0SizEabPHtdB9FRkLDZycCq32"]// Type array of string}{deviceId: "erEXZrc6QMOZgOL4YTLTlo",// Type stringmanufacturer: "CUBOT",// Type stringmodel: "CUBOT ECHO",// Type stringapi: 23,// Type numberfirstLoginAt: 15May2020at13:04:56UTC+2// Type timestamp}{geoPoint: [50.4214267°N,8.355768°E],// Type geopointhorizontalAccuracyMeters: 22.291000366210938,// Type numberbearing: 271.8037109375,// Type number; horizontal direction of travel in degrees 0.0-360.0speed: 0.10250464826822281,// Type number; meters/secondtime: 4May2020at07:16:40UTC+2// Type timestamp}{time: 5May2020at22:44:37UTC+2,// Type timestampmessage: "App started",// Type stringlevel: "INFO"// Type string}- The app will not start automatically after a reboot. You need to click the app icon "Asset Tracker".
- If the internet connection is lost, the location is recorded on the device and synced once the connection is reestablished.
David Neuy
MIT