我正在创建和应用程序类似于优步但不是创建两个单独的应用程序我将驾驶员和乘客活动放在同一个应用程序中......在驾驶员拒绝乘客请求后,会向驾驶员发送通知,通知他们驱动程序已拒绝请求...此通知生成错误:
E / UncaughtException:com.google.gson.JsonSyntaxException:java.lang.IllegalStateException:预期为BEGIN_OBJECT但在第1行第1行为STRING
在乘客应用程序中对该行的称赞
LatLng customer_location = new Gson()。fromJson(remoteMessage.getNotification()。getBody(),LatLng.class);
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);
}
}