Hello folks,
I have an application that runs audio streaming via ExoPlayer, which will not run on the Android 12 platform. My application details:
ExoPlayer runs in PlayerService.java:
public void startMyAudio () {
Notification notification = new NotificationCompat.Builder (this, getPackageName ())
...
startForeground (9573, notification);
player.prepare ();
player.play ();
}
I run PlayerService.java from MainActivity.java, using the code:
private final ServiceConnection playerService_connection = new ServiceConnection () {
@Override
public void onServiceConnected (ComponentName classname, IBinder service) {
playerService = IPlayerService.Stub.asInterface (service);
}
@Override public void onServiceDisconnected (ComponentName name) {playerService = null; }
};
@Override
protected void onCreate(Bundle savedInstanceState) {
...
bindService(new Intent(this, PlayerService.class), playerService_connection, Context.BIND_AUTO_CREATE);
...
}
And, of course, control the service with AIDL interface:
playerService.startMyAudio();
Manifest permissions are:
<uses-permission android:name = "android.permission.INTERNET" />
<uses-permission android:name = "android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name = "android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name = "android.permission.WAKE_LOCK" />
<uses-permission android:name = "android.permission.FOREGROUND_SERVICE" />
...
<service
android:name=".PlayerService"
android:enabled="true"
android:exported="true"
android:foregroundServiceType="mediaPlayback|dataSync"
android:permission="android.permission.INTERNET" />
I have no idea what to do next, because this works up to Android 12. What do I need to enable this app to run on Android 12? Was it enough to add Manifest permission as:
<uses-permission android:name = "android.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND" />
I ask this because I do not have the ability to run a virtual device on Android 12, nor an actual device on Android 12.
Thank you in advance.