Languages

Menu
Sites
Language
How to handle the tap of the simple status notification?

I want to know if there is a way to handle tap of the simple status notification?

Responses

14 Replies
Raghavendra Reddy Shiva

Refer below from the programming guide, on creating and handling the notifications.

https://developer.tizen.org/help/topic/org.tizen.web.appprogramming/html/guide/ui_guide/notification.htm

Also some articles with sample application here,

https://developer.tizen.org/documentation/articles/how-use-tizen-notification-api
https://developer.tizen.org/documentation/articles/notifications

Hope that helps !!

Alexander AVSukhov
Imgen Tata

Forgive me for being dumb, what appControl should I use?

konduri sai swathi

Hi ,

Try the below code :

try {
    	var appControl = new tizen.ApplicationControl(
				"http://tizen.org/appcontrol/operation/pick",
				null,
				"IMAGE",
				null);
		var notificationDict = {
				content : "Click to Launch Gallery",
				backgroundImagePath : "images/image5.jpg",
				soundPath : "music/Over the horizon.mp3", 
				vibration : true,
				appControl : appControl,
		};

		var notification = new tizen.StatusNotification("SIMPLE", 
				"Simple Notification", notificationDict);
		tizen.notification.post(notification);
	}catch (err) {
		console.log (err.name + ": " + err.message);
	}

The above code will launch gallery to pick an image when tapped on this notification. In the same way you can even open other applications by mentioning their app ID. Refer below code for this :

try {
		var notificationDict = {
				iconPath : "images/image5.jpg",
				vibration : true, 
				appId : "org.tizen.clock"
		};
		var Mynotification = new tizen.StatusNotification("SIMPLE", 
				"Go to APP", notificationDict); 
		tizen.notification.post(Mynotification);
	} catch (err) {
		console.log (err.name + ": " + err.message);
    } 

At "appId" you can mention the ID of the application you want to launch when notification is tapped.

Imgen Tata

Thanks for the great info, is there a way to launch my app and pass some parameter so that I can do things about at launch. Also I want to know if I let user launch my app when tap, if my app is running when user tap, will my app be terminated and relaunch or someting else?

Imgen Tata

In the below article

https://developer.tizen.org/documentation/articles/notifications

When user tap the updated notification, the second page of the app shows up. I downloaded the source code, looking into them, couldn't figure out how the author managed to do this miracle. Can someone shed some light?

konduri sai swathi

Hi,

I'm the author for that article.

Look into the config file source:

<tizen:app-control>
        <tizen:src name="index1.html"/>
        <tizen:operation name="http://tizen.org/appcontrol/operation/notification"/>
        <tizen:uri name="file"/>
</tizen:app-control>

"http://tizen.org/appcontrol/operation/notification" is the operation i created and mentioned in the config file. And  by giving ' src name="index1.html" ' we tell the application which uses "operation/notification" to open "index1.html" ( which acts like second page of the article ) . You can find "index1.html" in the project folder itself.

Imgen Tata

Thanks very much. Finally I can sleep well, :).

Imgen Tata

What about my other questions? Will my app be terminated when i use the notification to launch my own app by passing an app id of my app? Is there a way to pass parameter when launch the app? Thanks in advance. BTW, great article.

Alexander AVSukhov

Hello,

If you using appControl your app will be terminated.

For passing data you can use ApplicationControlData in ApplicationControl constructor

 https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.web.device.apireference%2Ftizen%2Fapplication.html

konduri sai swathi

Hi,

Below code would launch your own app.

try {
    	var myappInfo = tizen.application.getAppInfo();

		var notificationDict = {
				iconPath : "images/image5.jpg",
				vibration : true, 
				appId : myappInfo.id,
				backgroundImagePath : "/opt/apps/1hapSo6pXH.backup/icons/1hapSo6pXH.Notifications.png",
		};
		var Mynotification = new tizen.StatusNotification("SIMPLE", 
				"Go to My App", notificationDict); 
		tizen.notification.post(Mynotification);
	} catch (err) {
		console.log (err.name + ": " + err.message);
	} 

 

Imgen Tata

Thanks very much

fernando scalia

Does anybody knows if it is possible to have more than one icon at the notificiation, each one calling a different function (javascript) on the application?

Just like the default music player do.

 

tks

Nagaraju Bhusani

Can someone help me out of this issue. As I'm new to Tizen Wear web application development, and in this I'm trying to create a status notification from the app. I'm able to create the notification. Then when the user open the notification tray and trying to click on Open App then the Tizen wear app is not launching the app. And then when I try to open the app explicitely I could observe that the app loaded with the new page(home.html) which is the notification tried to launch.

Here is my code:

                 var appInfo = tizen.application.getAppInfo();

        var appCtrl = new tizen.ApplicationControl(

                'tizen.org/appcontrol/operation/create_content');        

        var notificationDict = {

            content : 'This is a simple notification.',

            iconPath : 'images/icon.png',

             soundPath: 'sounds/Beep-Once.wav',

            vibration : true,

            appControl : appCtrl,

            appId : appInfo.id

        };

        var notification = new tizen.StatusNotification('SIMPLE',

                'Simple notification', notificationDict);

        tizen.notification.post(notification);

In Congif.xml:

    <tizen:app-control>

        <tizen:src name="home.html"/>

        <tizen:operation name="tizen.org/appcontrol/operation/create_content"/>

    </tizen:app-control>

Can anyone help me out I'm using Samsung Gear S3 - 2.3.2.3 version.