这是通过代码注册广播接收器以在另一个进程中运行的方法吗?就像我在带有 android:process=":remote"属性的 list 文件中设置它一样。
Intent registerReceiver (BroadcastReceiver receiver, IntentFilter filter)
Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread.
android:process
... If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed and the broadcast receiver runs in that process.
最佳答案
Is that a way for register broadcast receiver to running in another process from the code?
registerReceiver()
,在 Context
上调用,适用于来自其他进程的广播。
但是,当接收到广播时,registerReceiver()
不会创建另一个进程,而 android:process
就是这样做的。 android:process
与发送广播的进程无关。
关于android - 从代码注册广播接收器以在远程进程中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46082289/