Android - Unable to receive local broadcast in my activity from service

前端 未结 3 1620
既然无缘
既然无缘 2020-12-12 02:33

I have my main activity that start a service (Location service) and I want that service to broadcast the new location each time a new location is found.

Thanks to th

3条回答
  •  时光取名叫无心
    2020-12-12 03:32

    LocalBroadcastManager does not work across processes. Your Service is running in a separate process.

    You can either run your Service in the same process as the Activity - by removing the process attribute from the element - or use some sort of IPC instead - e.g., by sending and receiving the broadcasts on a Context instead of LocalBroadcastManager.

提交回复
热议问题