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 MediaContro
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.
You can use the one line code in the manifest file. Its working for me.
<application
android:usesCleartextTraffic="true"
android:label="@string/app_name"
android:supportsRtl="true">
<activity
android: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.