Complete
over 5 years ago

Garmin Connect Mobile 4.22 for Android includes the changes to allow HTTP on 127.0.0.1.

Connect version 4.20 broke local http access?

Getting several reports of functionality no longer working, it looks like Android Garmin connect app version 4.20 may have broken web request to local host via urls like http://127.0.0.1:17580/sgv.json?count=3

Parents
  • Since i had some tim today i did some tests

    1. Using android studio i created an android app which did a plain HTTP request to a local webserver (in my case http://<ip>adress/script.php and show the output in a textview

    2. test this code under SDK 26, 28 and 29

    The outcome:

    - when using a webview it worked under all SDK's

    - when using a stringrequest Under SDK26: works perfectly, under SDK28 and 29 i immediately got a timeout error, just like currently happens in the ConnectIQ apps

    So i started studying the official Android documentation (developer.android.com/.../security-config.html) which states that only the defualt changes, but apps who need plainhttp still can use it if they specify it in a network security xml file and i found out there is a very easy fix, which solves all uses cases above

    1. Add  android:networkSecurityConfig="@xml/network_security_config" to the Application section in the manifest

    2. Create a file res/xml/network_security_config with the following contents:

    <?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
    <base-config cleartextTrafficPermitted="true">
    <trust-anchors>
    <certificates src="system" />
    </trust-anchors>
    </base-config>
    </network-security-config>

    I retested and found out the timeout error is gone, my app could do plain HTTP again, also on SDK 28 and 29.

    @Garmin developers: Please implement this fix!!!!!!!!!!!!!!!!!!!!!!!

Comment
  • Since i had some tim today i did some tests

    1. Using android studio i created an android app which did a plain HTTP request to a local webserver (in my case http://<ip>adress/script.php and show the output in a textview

    2. test this code under SDK 26, 28 and 29

    The outcome:

    - when using a webview it worked under all SDK's

    - when using a stringrequest Under SDK26: works perfectly, under SDK28 and 29 i immediately got a timeout error, just like currently happens in the ConnectIQ apps

    So i started studying the official Android documentation (developer.android.com/.../security-config.html) which states that only the defualt changes, but apps who need plainhttp still can use it if they specify it in a network security xml file and i found out there is a very easy fix, which solves all uses cases above

    1. Add  android:networkSecurityConfig="@xml/network_security_config" to the Application section in the manifest

    2. Create a file res/xml/network_security_config with the following contents:

    <?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
    <base-config cleartextTrafficPermitted="true">
    <trust-anchors>
    <certificates src="system" />
    </trust-anchors>
    </base-config>
    </network-security-config>

    I retested and found out the timeout error is gone, my app could do plain HTTP again, also on SDK 28 and 29.

    @Garmin developers: Please implement this fix!!!!!!!!!!!!!!!!!!!!!!!

Children
No Data