What is the simplest way to send message from local service to activity
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a service which is listening to the phone. When the phone goes IDLE, I want to send a message to my Activity. It looks like I have two options to accomplish this. BroadcastReceiver and binding to the Service. BroadcastReceiver looked like an easier mechanism, so I tried the following test. In my Activity: @Override protected void onStart() { super.onStart(); IntentFilter filter = new IntentFilter("MyAction"); registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Yay...