0

Is that a way for register broadcast receiver to running in another process from the code? Like if I set it in the manifest file with android:process=":remote" attribute.

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.

0

1 Answer 1

0

Is that a way for register broadcast receiver to running in another process from the code?

registerReceiver(), called on a Context, works for broadcasts that come from other processes.

However, registerReceiver() does not create another process when a broadcast is received, which is what android:process does. android:process has nothing to do with the process that sends the broadcast.

2
  • I don't think this answers the question. If you have manifest-receivers registered in a different process with implicit intent-filters you will now need to migrate it to code (as per android 8). I believe his question is how to do so. Im facing this same problem myself and at first glance it feels to me that it's not possible and targeting sdk 26 won't allow implicit filters on receivers registered in different processes.
    – user3629714
    Sep 13, 2017 at 15:30
  • 1
    @jvrodrigues: "I believe his question is how to do so" -- it's not strictly possible. You would need to have a separate process created by some other means (e.g., a service with android:process), then call registerReceiver() over there. Sep 13, 2017 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.