GiovanniPolese Well-Known Member Licensed User Longtime User Nov 28, 2022 #1 I commonly use OkHttpUtils2 library to call a WebService that I did on my site. Today I had a bad surprise, which seems not have an easy to find explanation. Usually, in a BrowSer, the working call is: http://www.mysite.it/MyWebService/MywebService.asmx?Request=.... In B4A, i use: Code: Dim Url as string : Url="http://www.mysite.it/MyWebService/MywebService.asmx" Dim ReqString as string: ReqString="Request=..." Dim JobTrasm as HttpJob JobTrasm.PostString(Url,ReqString) The App runs on devices with Internet SimCards, but, in Italian SimCard, I get JobTrasm.Success = true, while in Portuguese SimCard it return false. If I use the same Sim giving HotSpot to a computer, and issue the abovementioned "Http://www.mysite.it..." call, it works. The only not working case is in the B4A App and the JobTrasm error is: java.net.UnknownServiceException: CLEARTEXT communication to www.mysite.it not permitted by network security policy As I wrote, it seems not to be strictly related to the use of the Portuguese (only) sim card, but to the use of it with B4A, and, probably, with Vrsion 12.00. As a matter of fact I never had this problem before the last upgrade to Version 12. Thanks in advance for any hint.
I commonly use OkHttpUtils2 library to call a WebService that I did on my site. Today I had a bad surprise, which seems not have an easy to find explanation. Usually, in a BrowSer, the working call is: http://www.mysite.it/MyWebService/MywebService.asmx?Request=.... In B4A, i use: Code: Dim Url as string : Url="http://www.mysite.it/MyWebService/MywebService.asmx" Dim ReqString as string: ReqString="Request=..." Dim JobTrasm as HttpJob JobTrasm.PostString(Url,ReqString) The App runs on devices with Internet SimCards, but, in Italian SimCard, I get JobTrasm.Success = true, while in Portuguese SimCard it return false. If I use the same Sim giving HotSpot to a computer, and issue the abovementioned "Http://www.mysite.it..." call, it works. The only not working case is in the B4A App and the JobTrasm error is: java.net.UnknownServiceException: CLEARTEXT communication to www.mysite.it not permitted by network security policy As I wrote, it seems not to be strictly related to the use of the Portuguese (only) sim card, but to the use of it with B4A, and, probably, with Vrsion 12.00. As a matter of fact I never had this problem before the last upgrade to Version 12. Thanks in advance for any hint.
MarcoRome Expert Licensed User Longtime User Nov 28, 2022 #2 In Manifest add: B4X: CreateResourceFromFile(Macro, Core.NetworkClearText) Upvote 0
f0raster0 Well-Known Member Licensed User Longtime User Nov 28, 2022 #3 GiovanniPolese said: .The only not working case is in the B4A App and the JobTrasm error is: java.net.UnknownServiceException: CLEARTEXT communication to www.mysite.it not permitted by network security policy Click to expand... Have you added this in mifesteditor: SetApplicationAttribute(android:usesCleartextTraffic, "true") Upvote 0
GiovanniPolese said: .The only not working case is in the B4A App and the JobTrasm error is: java.net.UnknownServiceException: CLEARTEXT communication to www.mysite.it not permitted by network security policy Click to expand... Have you added this in mifesteditor: SetApplicationAttribute(android:usesCleartextTraffic, "true")
GiovanniPolese Well-Known Member Licensed User Longtime User Nov 28, 2022 #4 MarcoRome said: In Manifest add: B4X: CreateResourceFromFile(Macro, Core.NetworkClearText) Click to expand... Yes. Thanks. It resolved. Upvote 0
MarcoRome said: In Manifest add: B4X: CreateResourceFromFile(Macro, Core.NetworkClearText) Click to expand... Yes. Thanks. It resolved.
GiovanniPolese Well-Known Member Licensed User Longtime User Nov 28, 2022 #5 f0raster0 said: Have you added this in mifesteditor: SetApplicationAttribute(android:usesCleartextTraffic, "true") Click to expand... Then I put this instruction in manifest, and not the MarcoRome suggested one, and also this works. I don't know why, but both solutions seem valid. Thanks to all. Upvote 0
f0raster0 said: Have you added this in mifesteditor: SetApplicationAttribute(android:usesCleartextTraffic, "true") Click to expand... Then I put this instruction in manifest, and not the MarcoRome suggested one, and also this works. I don't know why, but both solutions seem valid. Thanks to all.
mcqueccu Expert Licensed User Longtime User Nov 28, 2022 #6 GiovanniPolese said: Then I put this instruction in manifest, and not the MarcoRome suggested one, and also this works. I don't know why, but both solutions seem valid. Thanks to all. Click to expand... Its the same thing packaged as macro. so just use the first one Upvote 0
GiovanniPolese said: Then I put this instruction in manifest, and not the MarcoRome suggested one, and also this works. I don't know why, but both solutions seem valid. Thanks to all. Click to expand... Its the same thing packaged as macro. so just use the first one
GiovanniPolese Well-Known Member Licensed User Longtime User Nov 28, 2022 #7 mcqueccu said: Its the same thing packaged as macro. so just use the first one Click to expand... Yes, it should be obvious, but better to have a confirmation. Upvote 0
mcqueccu said: Its the same thing packaged as macro. so just use the first one Click to expand... Yes, it should be obvious, but better to have a confirmation.
KMatle Expert Licensed User Longtime User Nov 29, 2022 #8 Better: Use https with you site. Otherwise you may violate EU privacy rights and get into trouble Upvote 0