我有一个BroadcastReceiver
.
AndroidManifest.xml
:
<!-- When starting calculator-->
<receiver android:name=".APP_CALCULATOR_class" >
<intent-filter>
<action android:name="android.intent.category.APP_CALCULATOR" >
</action>
</intent-filter>
</receiver>
APP_CALCULATOR_class.class
:
package com.startcalcevent.startcalcevent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class APP_CALCULATOR_class extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Calculator is on" , Toast.LENGTH_LONG).show();
}
}
为什么当我打开计算器应用程序时此代码不起作用?