スタバにてコード下書き
一気に盛り込むのは怖いので。つうかなんとなく emacs とかで差分を盛り込みたくなっていたりしてアレ。
とても微妙なんスけど
以下ってありなのだろうか。
@Override public void onStart(Intent intent, int startid) { super.onStart(intent, startid); Log.d(TAG, "onStart"); if (ACTION_EXECUTE.equals(intent.getAction())) { startWatch(); IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF); filter.addAction(Intent.ACTION_SCREEN_ON); registerReceiver(mReceiver, filter); // Notification と PendingIntent の用意 // StartForeground を invoke } else if (ACTION_STOP.equals(intent.getAction())) { stopWatch(); unregisterReceiver(mReceiver); // StopForeground を invoke } }
hoge.invoke って確認必要ですね。あと StartForeground に渡す Intent は ACTION_HOGE を仕込んでおいて云々は必要かも。そゆ意味では Service 側に boolean なフラグも持たさないとアレなのか。
あ、駄目だ。Notification からの start/stop は ACTION_NOTIFICATION とかにしておいて Notification に関わるソレ以外のナニを云々なのか。