我有一项定义为在其自己的流程上运行的服务:
<service
android:name="com.package.MyService"
android:enabled="true"
android:process=":remote">
我有一个运行该服务的类:
Intent intent = new Intent(context, MyService.class);
intent.setAction(Constants.ACTION);
context.startService(intent);
我正在尝试播放Intent
如下:
Intent broadcastIntent = new Intent(RECEIVER);
broadcastIntent.setAction(action);
broadcastIntent.putExtra(DATA, msg);
sendBroadcast(broadcastIntent);
这里我宣布我的接收者:
private final BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
//doSomething
};
但似乎onReceive从未被称为