Are Android's BroadcastReceivers started in a new thread?

前端 未结 5 1318
难免孤独
难免孤独 2020-12-05 00:01

If I have an inner class that extends BroadcastReceiver within my Service class, should I care about synchronization, when the BroadcastRecei

5条回答
  •  一个人的身影
    2020-12-05 00:31

    The onReceive() method is called on the main thread. So, in case all your access to the service class is done from within the main thread, you don't need any synchronization.

提交回复
热议问题