Activity组件与Service组件通过BroadcastReceiver监听器通信
1.首先,Activity的onCreate方法中要有启动后台Service的Intent
Intent intent = new Intent(this, xxxService.class);
startService(intent);
为了能在AndroidManifest.xml中注册Activity中的receiver(它是内部类形式),需要把其定义成static的
pub
原创
2017-04-06 15:54:46 ·
480 阅读 ·
0 评论