cbanks Active Member Licensed User Longtime User Jan 11, 2024 #1 I have the following code B4X: SetApplicationAttribute(android:usesCleartextTraffic, "true") in my manifest and it has worked for a long time. It no longer works. I am unable to stream mp3's from non-ssl sites now. Has something changed?
I have the following code B4X: SetApplicationAttribute(android:usesCleartextTraffic, "true") in my manifest and it has worked for a long time. It no longer works. I am unable to stream mp3's from non-ssl sites now. Has something changed?
MarcoRome Expert Licensed User Longtime User Jan 11, 2024 #2 CLEARTEXT communication to 192.168.0.101 not permitted by network security policy Hi All, I tried to implement the JRDC2 implementation of Erel in one program. The implementation of Erel is in the below URL: https://www.b4x.com/android/forum/threads/b4x-jrdc2-b4j-implementation-of-rdc-remote-database-connector.61801/ I get the following error: ResponseError. Reason... www.b4x.com Click to expand... Upvote 0
CLEARTEXT communication to 192.168.0.101 not permitted by network security policy Hi All, I tried to implement the JRDC2 implementation of Erel in one program. The implementation of Erel is in the below URL: https://www.b4x.com/android/forum/threads/b4x-jrdc2-b4j-implementation-of-rdc-remote-database-connector.61801/ I get the following error: ResponseError. Reason... www.b4x.com Click to expand...
cbanks Active Member Licensed User Longtime User Jan 11, 2024 #3 The following code does not work either: B4X: CreateResourceFromFile(Macro, Core.NetworkClearText) Upvote 0
aeric Expert Licensed User Longtime User Jan 11, 2024 #4 Is there any error message in the Logs? Upvote 0
Sagenut Expert Licensed User Longtime User Jan 11, 2024 #5 If your app is for personal use set B4X: targetSdkVersion="26" in the Manifest. Upvote 0
DonManfred Expert Licensed User Longtime User Jan 11, 2024 #6 Storage updates in Android 11 | Android Developers Android 11 introduces significant enhancements to external storage management, strengthening user data protection through improved scoped storage, new media file access methods, and refined permission models. developer.android.com Apps that run on Android 11 but target Android 10 (API level 29) can still request the requestLegacyExternalStorage attribute. This flag allows apps to temporarily opt out of the changes associated with scoped storage, such as granting access to different directories and different types of media files. After you update your app to target Android 11, the system ignores the requestLegacyExternalStorage flag. Click to expand... It does not work with targetsdk set to 30 or more i guess Last edited: Jan 11, 2024 Upvote 0
Storage updates in Android 11 | Android Developers Android 11 introduces significant enhancements to external storage management, strengthening user data protection through improved scoped storage, new media file access methods, and refined permission models. developer.android.com Apps that run on Android 11 but target Android 10 (API level 29) can still request the requestLegacyExternalStorage attribute. This flag allows apps to temporarily opt out of the changes associated with scoped storage, such as granting access to different directories and different types of media files. After you update your app to target Android 11, the system ignores the requestLegacyExternalStorage flag. Click to expand... It does not work with targetsdk set to 30 or more i guess
cbanks Active Member Licensed User Longtime User Jan 11, 2024 #7 Sagenut said: If your app is for personal use set B4X: targetSdkVersion="26" in the Manifest. Click to expand... I can't set the sdk lower because Google will then not accept the app in the Play Store. Upvote 0
Sagenut said: If your app is for personal use set B4X: targetSdkVersion="26" in the Manifest. Click to expand... I can't set the sdk lower because Google will then not accept the app in the Play Store.
cbanks Active Member Licensed User Longtime User Jan 11, 2024 #8 DonManfred said: Storage updates in Android 11 | Android Developers Android 11 introduces significant enhancements to external storage management, strengthening user data protection through improved scoped storage, new media file access methods, and refined permission models. developer.android.com It does not work with targetsdk set to 30 or more i guess Click to expand... I have had sdk set to 31 for quite a while and it has worked fine. I have not changed the sdk version and it just won't work now. Upvote 0
DonManfred said: Storage updates in Android 11 | Android Developers Android 11 introduces significant enhancements to external storage management, strengthening user data protection through improved scoped storage, new media file access methods, and refined permission models. developer.android.com It does not work with targetsdk set to 30 or more i guess Click to expand... I have had sdk set to 31 for quite a while and it has worked fine. I have not changed the sdk version and it just won't work now.
Sagenut Expert Licensed User Longtime User Jan 11, 2024 #9 If you have to publish on the market then you have to stick to Google Policy and I think that there are no workaround for this. Upvote 0
If you have to publish on the market then you have to stick to Google Policy and I think that there are no workaround for this.
OliverA Expert Licensed User Longtime User Jan 11, 2024 #10 cbanks said: I am unable to stream mp3's from non-ssl sites now. Has something changed? Click to expand... cbanks said: I have had sdk set to 31 for quite a while and it has worked fine. I have not changed the sdk version and it just won't work now. Click to expand... The test app below is using targetSdkVersion="33" and has no issues with the non-https site http://serenewonderfulsoothinglight.neverssl.com/online/ . Are you sure everything is working properly with the site you are trying to access? Update: Hardware: Pixel 7, OS: Android 14 Attachments ClearTextTest.zip ClearTextTest.zip 14.1 KB · Views: 457 Upvote 0
cbanks said: I am unable to stream mp3's from non-ssl sites now. Has something changed? Click to expand... cbanks said: I have had sdk set to 31 for quite a while and it has worked fine. I have not changed the sdk version and it just won't work now. Click to expand... The test app below is using targetSdkVersion="33" and has no issues with the non-https site http://serenewonderfulsoothinglight.neverssl.com/online/ . Are you sure everything is working properly with the site you are trying to access? Update: Hardware: Pixel 7, OS: Android 14
drgottjr Expert Licensed User Longtime User Jan 11, 2024 #11 same here; no problem with (personal use) app on android 14, sdk 33. note: it is possible to publish cleartext apps on play. you need a security policy. see this: https://www.b4x.com/android/forum/threads/cleartext-traffic-allowed-for-all-domains.126573/ you just need to set up a file with a list of the non-ssl sites your app uses. a global cleartext policy is not possible Upvote 0
same here; no problem with (personal use) app on android 14, sdk 33. note: it is possible to publish cleartext apps on play. you need a security policy. see this: https://www.b4x.com/android/forum/threads/cleartext-traffic-allowed-for-all-domains.126573/ you just need to set up a file with a list of the non-ssl sites your app uses. a global cleartext policy is not possible
cbanks Active Member Licensed User Longtime User Jan 12, 2024 #12 I've attached an updated app of the ClearTextTest with the problem I'm talking about. If you uncomment the https mp3 then it plays it fine. If you uncomment the http mp3 line then it doesn't play and throws an error (MEDIA_ERROR_UNKNOWN, -1015). One change that I made was switching from a paid web host to a free web host. Attachments ClearTextTestMP3.zip ClearTextTestMP3.zip 10.4 KB · Views: 451 Last edited: Jan 12, 2024 Upvote 0
I've attached an updated app of the ClearTextTest with the problem I'm talking about. If you uncomment the https mp3 then it plays it fine. If you uncomment the http mp3 line then it doesn't play and throws an error (MEDIA_ERROR_UNKNOWN, -1015). One change that I made was switching from a paid web host to a free web host.
OliverA Expert Licensed User Longtime User Jan 12, 2024 #13 cbanks said: I've attached an updated app Click to expand... The issue is not with the App but with the requirements of MediaPlayerStream. According to the B4X documentation: According to the native documentation the online resource must support progressive download. Click to expand... From some quick "Googling", it looks like a server has to support ranges (Accept-Ranges) and the "HTTP" server that hosts the MP3 file in question does not support ranges. I've attached an updated example that includes a way to test if a site supports Accept-Ranges Link: B4A - Audio Attachments ClearTextTestMP3v4.zip ClearTextTestMP3v4.zip 463.8 KB · Views: 426 Upvote 0
cbanks said: I've attached an updated app Click to expand... The issue is not with the App but with the requirements of MediaPlayerStream. According to the B4X documentation: According to the native documentation the online resource must support progressive download. Click to expand... From some quick "Googling", it looks like a server has to support ranges (Accept-Ranges) and the "HTTP" server that hosts the MP3 file in question does not support ranges. I've attached an updated example that includes a way to test if a site supports Accept-Ranges Link: B4A - Audio
drgottjr Expert Licensed User Longtime User Jan 12, 2024 #14 the site does have an accept-ranges header, but the particular mp3 is short and appears to have been obtained with a simple get. there doesn't seem to be much "streaming" involved. does op have another (preferably much longer) example? Upvote 0
the site does have an accept-ranges header, but the particular mp3 is short and appears to have been obtained with a simple get. there doesn't seem to be much "streaming" involved. does op have another (preferably much longer) example?
OliverA Expert Licensed User Longtime User Jan 12, 2024 #15 drgottjr said: the site does have an accept-ranges header, but the particular mp3 is short and appears to have been obtained with a simple get. Click to expand... So it looks like it is a server-side configuration issue as it pertains to small files on the HTTP server (if it otherwise supports accept-ranges). If you download the mp3's of both sites, they are the same size. The HTTP server does not support accept-ranges for that particular file and the HTTPS one does. My conclusion was that the HTTP server itself does not support accept-ranges, but it could be that it does not support accept-ranges for small(ish) file sizes (or maybe, for some reason, just this file). In the end, not having an accept-ranges in the returned header is why the file from the HTTP server fails to play with MediaPlayerStream. Upvote 0
drgottjr said: the site does have an accept-ranges header, but the particular mp3 is short and appears to have been obtained with a simple get. Click to expand... So it looks like it is a server-side configuration issue as it pertains to small files on the HTTP server (if it otherwise supports accept-ranges). If you download the mp3's of both sites, they are the same size. The HTTP server does not support accept-ranges for that particular file and the HTTPS one does. My conclusion was that the HTTP server itself does not support accept-ranges, but it could be that it does not support accept-ranges for small(ish) file sizes (or maybe, for some reason, just this file). In the end, not having an accept-ranges in the returned header is why the file from the HTTP server fails to play with MediaPlayerStream.
cbanks Active Member Licensed User Longtime User Jan 12, 2024 #16 Thanks to all for your help! I'm assuming at this point that a free web host will not suffice for what I want to do in my app. I've tried quite a few free web hosts and none of them seem to allow insecure mp3 streaming. I assume because of the lack of accept-ranges in the returned header. I was trying to get-away with not paying for a web host or ssl but that doesn't seem possible. Upvote 0
Thanks to all for your help! I'm assuming at this point that a free web host will not suffice for what I want to do in my app. I've tried quite a few free web hosts and none of them seem to allow insecure mp3 streaming. I assume because of the lack of accept-ranges in the returned header. I was trying to get-away with not paying for a web host or ssl but that doesn't seem possible.
OliverA Expert Licensed User Longtime User Jan 12, 2024 #17 cbanks said: I'm assuming at this point that a free web host will not suffice for what I want to do in my app. I've tried quite a few free web hosts and noce of them seem to allow insecure mp3 streaming. I assumed because of the lack of accep-ranges in the returned header. Click to expand... It depends. It could just be a configuration issue on the server that can either be changed by the user or maybe through a support ticket. Upvote 0
cbanks said: I'm assuming at this point that a free web host will not suffice for what I want to do in my app. I've tried quite a few free web hosts and noce of them seem to allow insecure mp3 streaming. I assumed because of the lack of accep-ranges in the returned header. Click to expand... It depends. It could just be a configuration issue on the server that can either be changed by the user or maybe through a support ticket.
OliverA Expert Licensed User Longtime User Jan 12, 2024 #18 cbanks said: a free web host will not suffice for what I want to do in my app Click to expand... OliverA said: It could just be a configuration issue Click to expand... Try this (not guaranteed to do anything): 1) In the folder where the mp3 file is located, create a file named .htaccess Click to expand... 2) Add the following content(s) to the file: <IfModule mod_headers.c> Header set Accept-Ranges 'bytes' </IfModule> Click to expand... This may not work, since the header must also include a correct content-length (the size of the file). Or the server used is not Apache-based. Or .htaccess is not allowed. And many other failure points... Upvote 0
cbanks said: a free web host will not suffice for what I want to do in my app Click to expand... OliverA said: It could just be a configuration issue Click to expand... Try this (not guaranteed to do anything): 1) In the folder where the mp3 file is located, create a file named .htaccess Click to expand... 2) Add the following content(s) to the file: <IfModule mod_headers.c> Header set Accept-Ranges 'bytes' </IfModule> Click to expand... This may not work, since the header must also include a correct content-length (the size of the file). Or the server used is not Apache-based. Or .htaccess is not allowed. And many other failure points...