This app accepts control by Intent from other apps.
Specifies the app mode. Required. Ignored if not specified.
- CLOCK
- STOPWATCH
- TIMER
Specifies a command. There are the following variations. Ignored if MODE is CLOCK
- START
- Changes to start state. Ignored if already started. If the count is progressing, it will continue.
- STOP
- Changes to stop state. Ignored if already stoped. If the count is progressing, it will continue.
- SET
- Sets the count to the specified value and changes to stop state. Specify the value in EXTRA_TIME. Therefore, EXTRA_TIME must be specified, otherwise this command will be ignored.
- SET_AND_START
- Sets the count to the specified value and changes to start state. Specify the value in EXTRA_TIME. Therefore, EXTRA_TIME must be specified, otherwise this command will be ignored.
Specifies the time when EXTRA_COMMAND is SET or SET_AND_START. Specify the time as a long value in milliseconds.
To start clock mode.
packageManager.getLaunchIntentForPackage("net.mm2d.timer")?.also {
it.putExtra("EXTRA_MODE", "CLOCK")
}?.let {
startActivity(it)
}
To start stopwatch mode and count up start from 0 seconds.
packageManager.getLaunchIntentForPackage("net.mm2d.timer")?.also {
it.putExtra("EXTRA_MODE", "STOPWATCH")
it.putExtra("EXTRA_COMMAND", "SET_AND_START")
it.putExtra("EXTRA_TIME", 0L)
}?.let {
startActivity(it)
}
To start timer mode and count down start from 2 minutes.
packageManager.getLaunchIntentForPackage("net.mm2d.timer")?.also {
it.putExtra("EXTRA_MODE", "TIMER")
it.putExtra("EXTRA_COMMAND", "SET_AND_START")
it.putExtra("EXTRA_TIME", 120_000L)
}?.let {
startActivity(it)
}
大前 良介 (OHMAE Ryosuke) http://www.mm2d.net/