'how to return result in cmd if you use adb to send a broadcast
I have a BroadcastReceiver like this:
class PlatformAccountReceiver:
BroadcastReceiver(), CoroutineScope by MainScope() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
ACTION_GET_STATUS -> {
// return result to cmd
}
else -> {}
}
}
companion object {
const val ACTION_GET_STATUS =
"com.example.ACTION_GET_STATUS"
}
}
And I send a broadcast from adb
adb shell am broadcast -p com.example.demo -a com.example.ACTION_GET_STATUS
Can I return some results to cmd, and show result to user?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|