我的应用程序使用由 BOOT_COMPLETE BroadcastReceiver 启动的服务,在运行中我收到错误
我的代码:
public class projet extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
intent = new Intent(context, ScreenshotService.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.bindService(intent, aslServiceConn, Context.BIND_AUTO_CREATE);
}
}
错误:
java.lang.RuntimeException: Unable to start receiver com.example.projet: android.content.ReceiverCallNotAllowedException: BroadcastReceiver components are not allowed to bind to services