我正在开发两个Android应用程序。第一个调用activity中的广播接收器。第二个包含从第一个应用程序调用的广播接收器。
当广播呼叫与呼叫者活动在同一个应用程序中时,我已经设法进行了广播呼叫。但是当我把接收器拿到单独的项目时,它不起作用。我应该改变什么?
发布于 2012-11-02 00:05:15
这是我如何注册receiver的:
<receiver
android:name=".TestReceiver"
android:enabled="true"
android:exported="true"
android:process=":deltaFO">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="com.myapp.intent.action.FILE_OPERATION" />
</intent-filter>
</receiver>这就是我发送意图的方式
Intent intent = new Intent("com.myapp.intent.action.FILE_OPERATION");
intent.putExtra("operation", operation);
context.sendBroadcast(intent);这是接收意图的类:
public class TestReceiver extends BroadcastReceiver{
public final String TAG="TestReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG,"EXTERNAL BROADCAST...");
}}
https://stackoverflow.com/questions/13177308
复制相似问题