Guest User

Untitled

a guest
Mar 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. public interface IFCMService {
  2. @Headers({
  3. "Content-Type:application/json",
  4. "Authorization:key=xxx"
  5. })
  6. @POST("fcm/send")
  7. Call<FCMResponse> sendMessage(@Body Sender body);
  8.  
  9. public class MyFirebaseMessagingService extends FirebaseMessagingService {
  10.  
  11. @Override
  12. public void onMessageReceived(RemoteMessage remoteMessage) {
  13.  
  14. Log.d("EARLYBIRD", remoteMessage.getNotification().getBody());
  15.  
  16. // Include Latitude and Longitude in firebase message
  17. LatLng customer_location = new Gson().fromJson(remoteMessage.getNotification().getBody(),LatLng.class);
  18.  
  19. Intent intent = new Intent(getBaseContext(), CustomerCall.class);
  20. intent.putExtra("lat",customer_location.latitude);
  21. intent.putExtra("lng",customer_location.longitude);
  22. intent.putExtra("customer",remoteMessage.getNotification().getTitle());
  23. intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  24.  
  25. startActivity(intent);
  26. }
  27. }
Add Comment
Please, Sign In to add comment