1.firebase console -> addproject -> create project ->android
2.kony visualizer ->projectSeting ->Native->Android-> packageName->
pushnotification->select GCM.
3.take sha1key from google:
{keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android}
take debug keystore from system i.e sdk Path.
{C:\Users\Truetech\.android\debug.keystore}
4.Cmd la paste.(SHA key gets generated.)
5.Open kpns-> add new app ->Application Name->Application ID we need to generate(note the app id for further use)->App Category :other-> next-> {android} ->GCM/FCM key ## firebase->settings->cloudmesseges
-> Legacy server key-> save##
6.app should be published. ## main point##
7. In kpns Go to api help-> select {JSON} ->now we have baseURL and sample request .go to mfconsole do integration with the help of baseURL and sample request.
8. open kony document kony.push.namespace-> senderid code-> Other coding.
/**
* Name : registerMyAndroidPush
* Author : Kony
* Purpose : This function registers the senderID on the Google cloud.
**/
function registerMyAndroidPush()
{
var config = {senderid:"4815552342"};
kony.push.register(config);
}
/**
* Name : regSuccessAndroidCallback
* Author : Kony
* Purpose : This function is the callback for the successful registration of the device to the GCM server. It returns the callerID.
*
**/
function regSuccessAndroidCallback(regId)
{
kony.print("** JavaScript regSuccessCallback() called **");
kony.print(regId);
}
/**
* Name : regFailureAndroidCallback
* Author : Kony
* Purpose : This function is the callback for the registration failure to the GCM server.
**/
function regFailureAndroidCallback(errormsg)
{
kony.print("* JavaScript regFailureCallback() called *");
kony.print(errormsg.failurereason]);
kony.print(errormsg.description);
}
function onlinePushNotificationAndroidCallback(msg)
{
kony.print("* JavaScript onlinePushNotificationCallback() called *");
kony.print(msg);
kony.print(msg.message);
}
/**
* Name : offlinePushNotificationAndroidCallback
* Author : Kony
* Purpose : This function is the callback for the received push msg event while offline
**/
function offlinePushNotificationAndroidCallback(msg)
{
kony.print("* JavaScript offlinePushNotificationCallback() called *");
kony.print(msg);
}
/**
* Name : unregSuccessAndroidCallback
* Author : Kony
* Purpose : This is the callback for the successful unregistration from the GCM server.
**/
function unregSuccessAndroidCallback()
{
kony.print("* JavaScript unregSuccessCallback() called *");
}
/**
* Name : unregFailureAndroidCallback
* Author : Kony
* Purpose : This is the callback for the unsuccessful deregistration from the GCM server.
**/
function unregFailureAndroidCallback(errormsg)
{
kony.print("* JavaScript unregFailureCallback() called *");
kony.print(errormsg.errorcode);
kony.print(errormsg.errormessage);
}
/**
* Name : callbackAndroidSetCallbacks
* Author : Kony
* Purpose : This function sets the callback for registration,deregistration and pushnotification events.
**/
function callbackAndroidSetCallbacks()
{
kony.push.setCallbacks({
onsuccessfulregistration: regSuccessAndroidCallback,
onfailureregistration: regFailureAndroidCallback,
onlinenotification: onlinePushNotificationAndroidCallback,
offlinenotification: offlinePushNotificationAndroidCallback,
onsuccessfulderegistration: unregSuccessAndroidCallback,
onfailurederegistration: unregFailureAndroidCallback});
}
9. Do Changes in coding { Add alert to #function onlinePushNotificationAndroidCallback#, #function regSuccessAndroidCallback#}
10.create other new function and place this two functions 1.function callbackAndroidSetCallbacks 2.function registerMyAndroidPush
!!!!!!!!!!!!!!!!!!!!!!!!!! call this function in postappinit !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11.Change sender id in coding. GET from ->firebase.
****
function pushNotificationNew(){
callbackAndroidSetCallbacks();
registerMyAndroidPush();
}
*******
12.getting device id goto mfconsole ->create new integration and paste base url FROM kpns API help URL and save and create operation (suffix no need).set method post
copy sample request from kpns
{
"subscriptionService" : {
"subscribe" : {
"sid" : "xxxx",
"appId" : "xxxx",
"ufid" : "xxxx",
"authToken" : "xxxx",
"osType" : "xxxx",
"deviceId" : "xxxx",
"deviceName" : "xxxx"
}
}
}
pass input from (sample sid) from above json.here
___________________________________________________________
"sid" : "123456"(anynumber),
"appId" : ""(autogenerate kpns),
"ufid" : "",
"authToken" : "",
"osType" : "android",
"deviceId" : ""(can got it by ddms),
"deviceName" : ""(your device name)
___________________________________________________________
check by online gcm testing
give device token (device id)
app key(legecy sever key)
message("ha ha")
*************************************************************************************************************************************
keytool -list -v -keystore C:\Users\somefolder\.android\debug.keystore -alias androiddebugkey -storepass android -keypass android
app id:132332-1992211795
*************************************************************************************************************************