Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface IFCMService {
- @Headers({
- "Content-Type:application/json",
- "Authorization:key=xxx"
- })
- @POST("fcm/send")
- Call<FCMResponse> sendMessage(@Body Sender body);
- public class MyFirebaseMessagingService extends FirebaseMessagingService {
- @Override
- public void onMessageReceived(RemoteMessage remoteMessage) {
- Log.d("EARLYBIRD", remoteMessage.getNotification().getBody());
- // Include Latitude and Longitude in firebase message
- LatLng customer_location = new Gson().fromJson(remoteMessage.getNotification().getBody(),LatLng.class);
- Intent intent = new Intent(getBaseContext(), CustomerCall.class);
- intent.putExtra("lat",customer_location.latitude);
- intent.putExtra("lng",customer_location.longitude);
- intent.putExtra("customer",remoteMessage.getNotification().getTitle());
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(intent);
- }
- }
Add Comment
Please, Sign In to add comment