0

I am currently building an awesome application that displays google map, then once there's a text message that contains long lat it will update the map. What I have tried is calling a function in broadcastreceiver ex.

String[] coords = smsBody.split(";");
String lat = coords[0];
String lng = coords[1];

   Double newLat = Double.parseDouble(lat);
   Double newLng = DOuble.parseDouble(lng);


   mapActivityFragment mapFrag = new mapActivityFragment();
   mapFrag.setLatLng(newLat, newLng);

The Google Map displays well on my onCreateView, but I am having a hard time; how can I get the lat lng from broadcastreceiver to display the new marker of the map

halfer
  • 19,824
  • 17
  • 99
  • 186
aintno12u
  • 341
  • 4
  • 23

1 Answers1

0

Upon checking some sources, I found some items that you can refer to:

Based on these sources, you need to create a private intent and BroadcastReceiver in your activity. Register this BroadcastReceiver once the activity starts. This will handle the setting up of marker to your map. Finally, invoke the private intent from the public BroadcastReceiver (SMS) by sending a broadcast containing the lat long values.

Hope this will help.

Community
  • 1
  • 1
rod
  • 21