pazaan / 600SeriesAndroidUploader

Your Medtronic 600-series pump data, direct to Nightscout
http://pazaan.github.io/600SeriesAndroidUploader/
MIT License
189 stars 312 forks source link

Android: Cannot send data to the server. CLEARTEXT communication to not permitted by network security policy #269

Open LubomirKovalcik opened 4 years ago

LubomirKovalcik commented 4 years ago

Your Environment

Brief Explanation of Issue

When trying to upload data to Nighscout, it throws error:

Android: Cannot send data to the server. CLEARTEXT communication to not permitted by network security policy

Uploader Error Code

Android: Cannot send data to the server. CLEARTEXT communication to not permitted by network security policy

Steps to Reproduce (for bugs)

  1. Setup nighscout URL and API key
  2. Connect Countour uploader USB
  3. Wait for data loading from Countour
  4. Throws error when trying to upload to Nighscout
Pogman commented 4 years ago

Your Nightscout URL address in the uploader needs to be in this form: https://sitename.herokuapp.com

LubomirKovalcik commented 4 years ago

I do not have https on my nightscout page. I am not using heroku or other cloud.

Pogman commented 4 years ago

Ah ok , the uploader will only work with https.

You can build the uploader with the follow changes to make it work with http:

Add src\main\res\xml\network_security_config.xml file with the following content:

<?xml version="1.0" encoding="utf-8"?>
<network_security_config xmlns:android="http://schemas.android.com/apk/res/android">
    <domain-config cleartextTrafficPermitted="true">
    </domain-config>
</network_security_config>

Add this line into AndroidManifest.xml as part of the application declarations:

android:networkSecurityConfig="@xml/network_security_config"

It will look like this when added:

    <application
        android:name=".UploaderApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:theme="@style/AppTheme">
Fix3l commented 4 years ago

Hi I'm not a developer and struggle during AndroidStuidio setup. Both Fabric and BugFender aren't available right now and if i try do build the project without them i get a gradle sync error. is there an easier way to build the apk with the changes above?

steve8x8 commented 4 years ago

@Fix3l did you upgrade gradle by accident?

Fix3l commented 4 years ago

Hm the first errors told that fabric isn't reachable or something. Androidstudio recommended to work in offline mode. After that the gradlesync error appears.

Sven-needs-help commented 2 years ago

Dear all,

I run into the same issue as mentioned above. My small son is using the Medtronics minimed 640G pump. I'm using the 600Series Android uploader you provided on the smartphone. Thanks a lot for the APP! However, I'd like to share the uploaded data on Nightscout on my own Windows Server physically located in my house in order to secure the data don't leave the house. In order to do so, I installed the Nightscout-on-Windows-Server as described from Jay Lagorio (https://github.com/jaylagorio/Nightscout-on-Windows-Server). The issue is that the server does not permit https:// as default (see issue No.5). As I'm not a SW developer I spent many hours but didn't get the server to work with certificates for https://. Since the network between the pump to the server via Smartphone is separated from the internet, I can accept the data to be transmitted by http://. I don't posses any SW development environment nor I have any knowledge/experience about it. So, is there any chance to get the uploader APP compiled which accepts http:// connections to share the data with the server? If I understand correctly, the proposal is written above.