top of page

Location Finder

  • 작성자 사진: Shin Yoonah, Yoonah
    Shin Yoonah, Yoonah
  • 2022년 7월 26일
  • 1분 분량

최종 수정일: 2022년 8월 11일

In this step, I added location finder function in my app!!


First, I set the permission code for accessing location finder (GPS) and set requesting access to be false in main method (line 36 & line 54)




Second, set the update interval, fastest update interval, and priority.

setInterval: This method sets the app's preferred location update reception interval in milliseconds. Location updates can be somewhat faster or slower than the interval set to optimize battery usage, and there may be no updates at all (for example, if the instrument is not connected).


setFastestInterval: This method sets the fastest interval in milliseconds for an app to process location updates. You do not need to invoke this method unless the app receives updates faster than the interval specified in setInterval().


setPriority: This method sets the priority of the request and provides powerful hints about the location source for the Google Play service location service.


setMaxWaitTime: Specifies the delay time. Typically, the setInterval() method carries a value several times greater than the interval specified. This setting can delay delivery of location information and deliver multiple location updates in batches. These two changes help minimize battery consumption



Third, create position method to request the accessing location finder



Fourth, create a class called "TTSLocationCallback" for saving our location in latitude and longitude




Let's test how it works!!


Comments


bottom of page