xml里面名称错了,少了个r,是BootReceiver 不是BootReceive
<receiver android:name=".BootReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".BootReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
解决方案 »
- 请教各位一个关于应用程序设置systemproperties的问题
- 跪求android nes模拟器源码
- android 不同activity中怎么传递参数,又不开启新的activity
- android真机上调用本机webservice,地址该如何写?
- Android XML 解析问题
- android UI ListView
- 求助:android浏览器中执行的js,要求:图片拖动进行切换
- andorid 用gson解析uri 出现乱码
- 如何在Android Studio里设置Build Tool版本?
- eclipse中svn添加资源文件库时添加url后就一直这样是怎么回事啊- -
- post传递数组 求帮助
- 手机支付宝客户端支付功能退款
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>java.lang.RuntimeException:
Unable to instantiate receiver MyName.MyName.BootReceiver: java.lang.ClassNotFoundException:
MyName.MyName.BootReceiver
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16" />
<application android:icon="@drawable/Icon" android:persistent="true">
</application>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>
仅需在BroadcastReceiver中直接写入
[IntentFilter(new[] { Android.Content.Intent.ActionBootCompleted })]
即可注册成功可以正常触发BootReceiver.cs [BroadcastReceiver]
[IntentFilter(new[] { Android.Content.Intent.ActionBootCompleted })]
public class BootReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
Toast.MakeText(context, "Received intent!", ToastLength.Short).Show();
}
}