use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class CallAsyncRequestsManager method createRejectCallRequest.
public static String createRejectCallRequest(RejectCallRequest request, String uniqueId) {
AsyncMessage message = new AsyncMessage();
message.setType(ChatMessageType.Constants.REJECT_CALL);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setSubjectId(request.getCallId());
message.setUniqueId(uniqueId);
JsonObject a = (JsonObject) App.getGson().toJsonTree(message);
return a.toString();
}
use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class PodNotificationManager method createUpdateUserDeviceRequest.
private static void createUpdateUserDeviceRequest(String newToken) {
String uniqueId = generateUniqueId();
STATE = NEED_REFRESH_TOKEN;
Map<String, String> tokensMap = new HashMap<>();
tokensMap.put(fcmToken, newToken);
AsyncMessage message = new AsyncMessage();
message.setContent(App.getGson().toJson(tokensMap));
message.setType(ChatMessageType.Constants.UPDATE_FCM_APP_USERS_DEVICE);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
message.setTypeCode(CoreConfig.typeCode);
messageUniqueId = uniqueId;
listener.sendAsyncMessage(App.getGson().toJson(message), "UPDATE_FCM_APP_USERS_DEVICE");
}
use of com.fanap.podchat.mainmodel.AsyncMessage in project pod-chat-android-sdk by FanapSoft.
the class PodNotificationManager method createRegisterUserDeviceRequest.
private static void createRegisterUserDeviceRequest(Context context, long userId) {
if (userId <= 0) {
if (listener != null)
listener.onNotificationEvent("Try to register device but user id was 0");
return;
}
String uniqueId = generateUniqueId();
STATE = NEED_REGISTER_USER_DEVICE;
Map<String, String> userDeviceTokenMap = new HashMap<>();
userDeviceTokenMap.put(fcmToken, String.valueOf(userId));
FcmAppUsersVO fcmAppUsersVO = new FcmAppUsersVO();
fcmAppUsersVO.setAppId(context.getApplicationInfo().packageName);
fcmAppUsersVO.setUserDeviceTokenMap(userDeviceTokenMap);
AsyncMessage message = new AsyncMessage();
message.setContent(App.getGson().toJson(fcmAppUsersVO));
message.setType(ChatMessageType.Constants.REGISTER_FCM_USER_DEVICE);
message.setToken(CoreConfig.token);
message.setTokenIssuer(CoreConfig.tokenIssuer);
message.setUniqueId(uniqueId);
message.setTypeCode(CoreConfig.typeCode);
messageUniqueId = uniqueId;
listener.sendAsyncMessage(App.getGson().toJson(message), "Register notification device and user");
}
Aggregations