Languages

Menu
Sites
Language
Tapping on the notification camera application gets launched.

Hi,

 

We have implemented the code for PUSH notification in one of our app. The PUSH notification is coming up proper after certain amount of time. But when we tap on the notification it launches camera.

Below is the code which we are using to get the PUSH notification.

function notificationCallback(noti)
{
//alert("Inside Received Notification...")
console.log("Notification received with alert message: " + noti.alertMessage + noti.appData + noti.message);
 
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content", 
            null, "image/jpg", null, null);
 
var notificationDict = 
{
/* Notification content */
content: noti.appData,
/* Path to the notification icon */
iconPath: "/image/icon.jpg",
/* Device vibrates when the notification is displayed */
vibration: true, 
/* Application control to be launched when the user selects the notification */
appControl: appControl
};
 
var notification = new tizen.StatusNotification("SIMPLE", "Device Monitr Notification", notificationDict);
 
tizen.notification.post(notification);  
}
 
Can you tell us whether there is an issue with the above code. And let us know the solution at the earliest.
 
Thanks. :)
Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

4 Replies
Raghavendra Reddy Shiva
The camera application is launched because, you have defined your Application control (appControl) to launch camera, when the user selects the notification. var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content", null, "image/jpg", null, null); So define the application control depending on what you want to do, when the user selects the notification.
shovan roy
Hi, Chaning the url in appControl variable mentioned in the above code snippet. We stopped the app from opening the camera. We followed https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.web.appprogramming%2Fhtml%2Fguide%2Fapp_guide%2Fapplication_service.htm to take guidance. One issue still exist for the NOTIFICATION is that, on tapping the notification we are not able to go back to the app. We don't want to do anything. Once the user gets the notification, on tapping the user should be redirected to the app. How can we achieve this?? Can you let us know a solution for the same.
konduri sai swathi
Hi, Try the below code :
try {
		var myappInfo = tizen.application.getAppInfo();

		var notificationDict = {
				content:"Click for Application Page",
				iconPath : "images/image5.jpg",
				vibration : true, 
				appId : myappInfo.id,
		};
		var Mynotification = new tizen.StatusNotification("SIMPLE", 
				"Back to App Page", notificationDict); 
		tizen.notification.post(Mynotification);
	} catch (err) {
		console.log (err.name + ": " + err.message);
	} 
Mention your application ID at "appId" property during creation of notification to return to your application.
shovan roy
Thanks konduri sai swathi. This is solution is working. But I need the app to go to the same page where the user had visited last rather than re-launching the app again. Can this be done also?