查询我的服务何时会在 Android 中 运行?

Query for when my service will be run in Android?

我有一个服务每 5 分钟左右触发一次...我如何查询 android 以查看该服务计划何时以编程方式关闭?

    <!-- Send Census Service -->
    <service android:name="services.scheduled.SendCensusScheduledService"
             android:icon="@drawable/ic_launcher"
             android:label="SyncServerDataScheduledService" />
    <receiver android:name="services.receivers.SendCensusScheduledServiceReceiver" >
        <intent-filter>
            <action android:name="ReceiptBucketClient.android.action.broadcast"/>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>
    <receiver android:name="services.receivers.StartSendCensusScheduledServiceReceiver" />

检查 PendingIntent:

PendingIntent intent = PendingIntent.getBroadcast(context, 0, 
        new Intent("ReceiptBucketClient.android.action.broadcast"), 
        PendingIntent.FLAG_NO_CREATE;

if (intent != null) {
   // you have the service scheduled. Cancel it!
   intent.cancel();
}

记住 only the original application owning a PendingIntent can cancel it.