Search code examples
androidgoogle-mapsaccelerometer

Android App using accelerometer and Google Maps API


I want to develop an app that reads the accelerometric values(of the phone's accelerometer) and on passing a certain threshold value of accelerometer, it should send a message with the phones position in Google Maps co-ordinates. Is this project technically feasible? I can develop an app that reads accelerometer values but how to design it in such a way that sends a message of the phone's co-ordinates in Google Maps?


Solution

  • Your question is too broad to supply code for it, that you will have to do yourself, but here are the steps you will need to implement.

    1. Set up a google maps activity/fragment. This is explained in detail on the google developer docs.
    2. Receive an event when accelerometer value's are updated.
    3. Based on the accelerometer values, determine whether or not threshold is passed. If yes proceed with 4&5, if not, exit and wait for new accelerometer readings.
    4. Get a Location(lat/long) from the FusedLocationApi. This is explained in detail on the google developer docs.
    5. Place a marker on the map with that Location. If there was already a marker from a previous reading, remove that one before adding the new one.