广播来自远程流程服务的意图

时间:2016-09-12 18:52:58

标签: android android-intent service broadcastreceiver remote-process

我有一项定义为在其自己的流程上运行的服务:

<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从未被称为

0 个答案:

没有答案