我对 Android 很陌生,我正在尝试了解该服务。
我的清单文件看起来:
<!--The invoice launcher service-->
<service android:process=":invoice_background"
android:name="InvoiceManagerService"
android:label="invoice_service" />
<!--The receiver-->
<receiver android:name="InvoiceStartupReceiver"
android:process=":invoice_background">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
我的服务看起来像:
public class InvoiceManagerService extends Service {
public IBinder onBind(Intent intent) {
return null;
}
}
我的接收器看起来像:
public class InvoiceStartupReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
Intent invoiceService = new Intent(context, InvoiceManagerService.class);
context.startService(invoiceService);
}
}
我的应用程序正在执行,没有任何错误。但是没有创建任何服务!我在哪里犯错误?
提前致谢。