Java Question Example code for handling Activity events in a service

corwin42

Expert
Licensed User
Longtime User
On many posts Erel said that it should be possible to handle (custom) activity events in a service.

For the PreferenceActivity Library I would like to implement such a feature so that it will be possible to use the preference activity from a widget service.

Is there anywhere an example of how to implement this or any tips or suggestions?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There are several ways to implement such a solution. In the case of preference screen the simplest solution that I can think of is to use intents for the events.

Add an intent filter to the service as described here: Intent Filters - Intercepting SMS messages in the background
Define your own action name. In your activity you should use BA.applicationContext.sendBroadcast to send the intents from your activity.
 
Top