Following is the code snippit for receiving notification:
function register(){
function registerSuccessCallback(registrationId)
{
// once get registration id sending to server.
// We are getting registration id every time we don't have any problem here.
}
function errorCallback(response)
{
}
function stateChangeCallback(state) {
if (state == 'UNREGISTERED') {
tizen.push.register(registerSuccessCallback, errorCallback);
}
}
function notificationCallback(noti) {
function onsuccess(){
}
var msg=noti.alertMessage;
// If application in foreground then control comes here.
// If application in background then control not coming here. Instead application gets restarted in tizen version 4.0.0.7
}
var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test");
tizen.push.connect(stateChangeCallback, notificationCallback, errorCallback);
tizen.push.register(registerSuccessCallback, errorCallback);
}
/// Sending push notification from server
{
"regID":"<Correct registration id>",
"requestID":"150bca2f3e9-39cb-4887-b3ab-61440770c5ed1596005116555",
"sender":"App",
"type":0,
"message":"action=LAUNCH&alertMessage=NewMessage",
"appData":"{userId:880}"
}
///
Problem:
When application is in foreground then push notification control comes correctly in the notificationCallback() in new(4.0.0.7) and old(4.0.0.4) tizen versions.
When application is in background then push notification control not coming correctly in the notificationCallback() in new(4.0.0.7) instead everytime push notification
come to watch, application getting restarted. This happens only with new(4.0.0.7) tizen update.
With old(4.0.0.4) tizen version if application is in background and push notification come then notificationCallback() getting called correctly without restarting application.
So, Why in new(4.0.0.7) tizen version application is getting restarted?