FCM Registration
#
OverviewThis document describes how to configure the push notification feature in the GCCS authentication process.
#
Feature DescriptionThere can be a circumstance when the user requests GCCS authentication from a non-mobile platform such as the web or window.
To receive the push notification in the mobile app that has implemented the Android SDK, FCM registration and the token update feature is necessary.
#
FCM Server keyIn order to receive the push notifications, the server key generated by Firebase Cloud Messaging (FCM) must be sent together with the client issuance request. The FCM server key can be found in the process below.
- Create or load the project in the Firebase Console.
- [Project Settings] > get the Server Key from [Cloud Messaging] menu.
If the client needs registration, note that the FCM server key is indispensable.
#
FCM Push notification token registrationFCM push token should be registered so that it can be used for notifying authentication request.
By using the registerPushToken()
from GuardianSdk
, the FCM push token that was generated from the Android device can be called to be registered and updated.
FCM push token can be changed due to expiration, etc. It should be updated by calling registerPushToken()
.
#
ParameterKey | Value | Description |
---|---|---|
token | String | FCM push notification token |
#
Example// FCM Push notification token registeredFirebaseInstanceId.getInstance().getInstanceId() .addOnSuccessListener(new OnSuccessListener<InstanceIdResult>() { public void onSuccess(InstanceIdResult instanceIdResult) { String token = instanceIdResult.getToken();
GuardianSdk.getInstance().registerPushToken(token, new GuardianResponseCallback<ResultResponse>() { @Override public void onSuccess(ResultResponse result) { Log.i(TAG, "Result code : " + result.rtCode); } @Override public void onFailed(ErrorResult errorResult) { Log.e(TAG, "Error code : " + errorResult.getErrorCode()); } }); }});
// FCM Push notification token renewedpublic class FirebasePushService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { }
@Override public void onNewToken(String token) { super.onNewToken(token); GuardianSdk.getInstance().registerPushToken(token, new GuardianResponseCallback<ResultResponse>() { @Override public void onSuccess(ResultResponse result) { Log.i(TAG, "Result code : " + result.rtCode); }
@Override public void onFailed(ErrorResult errorResult) { Log.e(TAG, "Error code : " + errorResult.getErrorCode()); } }); }}
#
ResultResponseKey | Value | Description |
---|---|---|
rtCode | 0 | Result code |
rtMsg | String | Result message |
If the API call to register FCM push token is successful, the rtCode
will be 0
#
ErrorResultKey | Value | Description |
---|---|---|
errorCode | Int | Error code |
errorMessage | String | Error message |
If API call fails, the user will receive an errorCode
#
FCM Push Message TransferIf requesting an authentication on web
or window
with using user key, a message is transferred through FCM on mobile application.
In case of receiving a push message after an authentication,
it proceeds an authentication process by calling authMessageProcessing
of GuardianSdk
.
#
ParameterKey | Value | Description |
---|---|---|
remoteMessage | Map<String,String> | Authentication push message |
#
Examplepublic class FirebasePushService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { GuardianSdk.getInstance().authMessageProcessing(remoteMessage.data) }
@Override public void onNewToken(String token) {}
}
---