finish() 是 Activity 的方法,用於結束 Activity 實例。
onReceive() 執行完即視為結束,系統自動回收。stopSelf() 或 stopService() 停止,或由 WakefulBroadcastReceiver 完成喚醒鎖釋放後自動停止。WakefulBroadcastReceiver 接收廣播,取得喚醒鎖WakefulIntentService(IntentService 子類)onHandleIntent() 執行耗時任務(下載資料)WakefulIntentService 內部呼叫 completeWakefulIntent() 釋放鎖並 stopSelf()完全不需要也不應該呼叫 finish()。正確做法是確保 Service 任務完成後自動停止,或在 Receiver 中啟動 Service 後直接返回。