所以我正在尝试开发自定义锁屏
但我的广播接收器不会开火
我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.alexander.fuchs.lockscreen"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".app"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".myreceiver">
<intent-filter>
<action android:name="android.intent.action.SCREEN_OFF"/>
<action android:name="android.intent.action.SCREEN_ON"/>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
</application>
</manifest>
我的接收器:
public class myreceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("receiver","works");
Toast.makeText(context,"works",Toast.LENGTH_LONG).show();
Intent in=new Intent(context,app.class);
context.startActivity(in);
}
}
接收器应该告诉我它被解雇了:D但logcat中没有任何日志