Class TrackRecorder


  • public final class TrackRecorder
    extends java.lang.Object
    A class providing an API allowing to record GPS track files.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDirectoryPath()
      Allows to get a directory path, which should be used to save tracks.
      boolean isRecording()  
      void saveCurrentTrack()
      Saves current track to a file.
      void setDirectoryPath​(java.lang.String path)
      Allows to set a directory path, which should be used to save tracks.
      void start()
      Starts recording GPS locations.
      void stop()
      Stops recording GPS locations and saves current track to a file.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isRecording

        public boolean isRecording()
        Returns:
        true if track recorder is currently recording.
      • getDirectoryPath

        public java.lang.String getDirectoryPath()
        Allows to get a directory path, which should be used to save tracks. By default tracks are being stored in the following directory:
        
         new File(context.getFilesDir(),
             "assets" + File.pathSeparator + "UserData" + File.pathSeparator + "Tracks")
         
      • setDirectoryPath

        public void setDirectoryPath​(java.lang.String path)
        Allows to set a directory path, which should be used to save tracks.
      • start

        public void start()
        Starts recording GPS locations.
      • stop

        public void stop()
        Stops recording GPS locations and saves current track to a file.
      • saveCurrentTrack

        public void saveCurrentTrack()
        Saves current track to a file. Starts recording a new track.