feat: Support connecting to the API on localhost
This is a temporary solution, which adds an exception for 10.0.2.2, allowing access over HTTP (without TLS). Once the app is production-ready, it should use a publically hosted API.
This commit is contained in:
parent
ec81d4ee12
commit
0c0839a7d8
|
@ -5,6 +5,7 @@
|
|||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
|
|
|
@ -10,7 +10,8 @@ import android.util.Log
|
|||
import okhttp3.ResponseBody
|
||||
|
||||
object RetrofitClient {
|
||||
private const val BASE_URL = "https://90f2-213-160-184-230.ngrok-free.app"
|
||||
// Points to localhost on the machine running the emulator
|
||||
private const val BASE_URL = "http://10.0.2.2:8000"
|
||||
|
||||
private val retrofit: Retrofit by lazy {
|
||||
Retrofit.Builder()
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</PreferenceScreen>
|
||||
<network-security-config xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
<domain includeSubdomains="true">10.0.2.2</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
||||
|
|
Loading…
Reference in a new issue