Video From Url Working On Android 4 But Not On Android 9
This code works on Android 4.4.2 but does not work on the phone with Android 9: String url='http://...LINK...mp4'; MediaController controller = new MediaController(context); contro
Solution 1:
Android 9.0 blocks cleartext (http
) traffic by default.
The preferred solution is to not use http
URLs, but instead use https
.
You can, through network security configuration, tell Android to allow cleartext traffic for your app, but this is less secure.
Solution 2:
You can use the one line code in the manifest file. Its working for me.
<applicationandroid:usesCleartextTraffic="true"android:label="@string/app_name"android:supportsRtl="true"><activityandroid:name=".EvaBotView"android:theme="@style/AppTheme.NoActionBar"android:configChanges="keyboardHidden|orientation|screenSize"/></application>
Inside application tag we can use android:usesCleartextTraffic="true" which can resolve this issue.
Post a Comment for "Video From Url Working On Android 4 But Not On Android 9"