Android Question problem http on android 9

moster67

Expert
Licensed User
Longtime User
Try to implement what is mentioned in this post:
https://www.b4x.com/android/forum/threads/android-jar-targetsdkversion-minsdkversion.87610/

- 28 - Non-ssl (non-https) communication is not permitted by default. It can be enabled in B4A v9+ by adding this line to the manifest editor:
B4X:
CreateResourceFromFile(Macro, Core.NetworkClearText)

Edit: I noted that you are using B4A v.8.5. Try to add this to the manifest:
B4X:
SetApplicationAttribute(android:usesCleartextTraffic, "true")
 
Upvote 0

aldomoscarda

Member
Licensed User
Longtime User
Thanks for your message.

Add this to the manifest and it does NOT work.

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:usesCleartextTraffic, "true")
'End of default text.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Thanks Erel! I will buy version 9.01 of B4A and see if the error continues and will notify you.

You did not get the point. Http is insecure, Https is secure (encrypted). Android 9 does not allow insecure connections unless you change the setting. It's not an error.
 
Upvote 0

aldomoscarda

Member
Licensed User
Longtime User
Thank @KMatle
You did not get the point. Http is insecure, Https is secure (encrypted). Android 9 does not allow insecure connections unless you change the setting. It's not an error.

Now I have the B4A, v9.3. I manifested this but it DOES NOT WORK.

MANIFEST
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:usesCleartextTraffic, "true")
CreateResourceFromFile(Macro, Core.NetworkClearText)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.ACCESS_CHECKIN_PROPERTIES)
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.ACCESS_LOCATION_EXTRA_COMMANDS)
AddPermission(android.permission.ACCESS_MOCK_LOCATION)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_SURFACE_FLINGER)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.ACCOUNT_MANAGER)
AddPermission(android.permission.ADD_VOICEMAIL)
AddPermission(android.permission.AUTHENTICATE_ACCOUNTS)
AddPermission(android.permission.BATTERY_STATS)
AddPermission(android.permission.BIND_ACCESSIBILITY_SERVICE)
AddPermission(android.permission.BIND_APPWIDGET)
AddPermission(android.permission.BIND_DEVICE_ADMIN)
AddPermission(android.permission.BIND_INPUT_METHOD)
AddPermission(android.permission.BIND_NFC_SERVICE)
AddPermission(android.permission.BIND_NOTIFICATION_LISTENER_SERVICE)
AddPermission(android.permission.BIND_PRINT_SERVICE)
AddPermission(android.permission.BIND_REMOTEVIEWS)
AddPermission(android.permission.BIND_TEXT_SERVICE)
AddPermission(android.permission.BIND_VPN_SERVICE)
AddPermission(android.permission.BRICK)
AddPermission(android.permission.CHANGE_CONFIGURATION)
AddPermission(android.permission.CHANGE_NETWORK_STATE)
AddPermission(android.permission.CLEAR_APP_CACHE)
AddPermission(android.permission.CLEAR_APP_USER_DATA)
 
Upvote 0

aldomoscarda

Member
Licensed User
Longtime User
I also try to change to this, but it DID NOT WORK.

MANIFEST
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:networkSecurityConfig, @xml/network_security_config)
CreateResource(xml, network_security_config.xml,
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
)

AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.ACCESS_CHECKIN_PROPERTIES)
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.ACCESS_LOCATION_EXTRA_COMMANDS)
AddPermission(android.permission.ACCESS_MOCK_LOCATION)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_SURFACE_FLINGER)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.ACCOUNT_MANAGER)
AddPermission(android.permission.ADD_VOICEMAIL)
AddPermission(android.permission.AUTHENTICATE_ACCOUNTS)
AddPermission(android.permission.BATTERY_STATS)
AddPermission(android.permission.BIND_ACCESSIBILITY_SERVICE)
AddPermission(android.permission.BIND_APPWIDGET)
AddPermission(android.permission.BIND_DEVICE_ADMIN)
AddPermission(android.permission.BIND_INPUT_METHOD)
AddPermission(android.permission.BIND_NFC_SERVICE)
AddPermission(android.permission.BIND_NOTIFICATION_LISTENER_SERVICE)
AddPermission(android.permission.BIND_PRINT_SERVICE)
AddPermission(android.permission.BIND_REMOTEVIEWS)
AddPermission(android.permission.BIND_TEXT_SERVICE)
AddPermission(android.permission.BIND_VPN_SERVICE)
AddPermission(android.permission.BRICK)
AddPermission(android.permission.CHANGE_CONFIGURATION)
AddPermission(android.permission.CHANGE_NETWORK_STATE)
AddPermission(android.permission.CLEAR_APP_CACHE)
AddPermission(android.permission.CLEAR_APP_USER_DATA)

'End of default text.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Upvote 0

KMatle

Expert
Licensed User
Longtime User

Yes... but... It's VERY important to use RSA/AES (= https) so that the connection is ecrypted. OKHttpUtils does this automatically for you. Otherwise all of the traffic can be hacked/read easily. Take care of it when you publish such an app. Customers will NOT like it and you WILL get into problems.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User

Another one: I can access your system via my browser just by typing the IP address from your post :D XAMPP ist good for test environments but it's not for production systems.

Note: Of course I will not do anything (but I could).

1.JPG
 
Upvote 0
Top