talmantel / CheapTripAndroid

0 stars 3 forks source link

Add support for auto detecting the country of current device location #3

Open denis-luttcev opened 3 years ago

denis-luttcev commented 3 years ago

Reason: Targeting affiliate programs according to the current location of the device, also to use geolocation may be useful to call a taxi, or open maps.

Implementation:

First, make a business decision about the need to determine the fine location.

If approximate enough, the best I've found - call http://ip-api.com/json, the documentation is available. Need to implement http-client (use Ktor multi-platform client, see this isuue for details) and one of the json deserialization libraries. If fine geolocation is required, implement a request for the necessary permissions (including at runtime) and use access to GPS.

Actual/expected val currentCountry in System.kt files would be a suitable place to locate.

Finally add auto detecting logic in ru.z8.louttsev.cheaptripmobile.androidApp.adapters.PathListAdapter (marked with the number of this issue).