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

前端 未结 3 1631
既然无缘
既然无缘 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:31

    In your LocationService, send local broadcast using:

    Intent intent = new Intent(CMBroadcastReceiver.RECEIVE_LOCATION_UPDATE);
    LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
    

提交回复
热议问题