For years I've used my app to listen to radio stations from around the world with ExoPlayer.
Since this new version of Android, I've been getting this error, and although I've read the few posts on the forum, I can't figure out the solution. The error is due to BroadcastReceiver, which I use to control the app's volume even when the screen is off (I don't know if there's another way to do it).
I've included the error log and a snippet of the code where it occurs.
(Google Translate)
Since this new version of Android, I've been getting this error, and although I've read the few posts on the forum, I can't figure out the solution. The error is due to BroadcastReceiver, which I use to control the app's volume even when the screen is off (I don't know if there's another way to do it).
I've included the error log and a snippet of the code where it occurs.
(Google Translate)
B4X:
*** Service (srvexoplayer) Create ***
** Service (srvexoplayer) Start **
BroadcastReceiver has been initialized.
Error occurred on line: 70 (srvExoPlayer)
java.lang.SecurityException: com.modes.radio: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
at android.os.Parcel.createExceptionOrNull(Parcel.java:3256)
at android.os.Parcel.createException(Parcel.java:3240)
at android.os.Parcel.readException(Parcel.java:3223)
at android.os.Parcel.readException(Parcel.java:3165)
at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6512)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1915)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1855)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1843)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:794)
at com.rootsoft.broadcastreceiver.BroadCastReceiver.registerReceiver(BroadCastReceiver.java:52)
at com.modes.radio.srvexoplayer._service_start(srvexoplayer.java:1113)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at com.modes.radio.srvexoplayer.handleStart(srvexoplayer.java:103)
at com.modes.radio.srvexoplayer.access$000(srvexoplayer.java:8)
at com.modes.radio.srvexoplayer$1.run(srvexoplayer.java:74)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand(ServiceHelper.java:240)
at com.modes.radio.srvexoplayer.onStartCommand(srvexoplayer.java:72)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:5548)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2711)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loopOnce(Looper.java:249)
at android.os.Looper.loop(Looper.java:337)
at android.app.ActivityThread.main(ActivityThread.java:9469)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:636)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1005)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiverWithFeatureTraced(ActivityManagerService.java:15806)
at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:15602)
at android.app.IActivityManager$Stub.onTransact$registerReceiverWithFeature$(IActivityManager.java:13060)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:3386)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3091)
Program code:
Sub Service_Start (StartingIntent As Intent)
If PararServicio Or Not(IsVisible) Or Broadcast.isRegistered Then Return
Broadcast.Initialize("BR")
Broadcast.addAction("android.media.VOLUME_CHANGED_ACTION")
Broadcast.SetPriority(2147483647)
Broadcast.registerReceiver("") <---- ERROR
If Not(Exoplayer.IsPlaying) Then
AbriendoEmisora.Initialize
End If
StartServiceAt(Me, DateTime.Now + 30 * DateTime.TicksPerMinute, True)
End Sub