From 1606c40be2d9c1bd49df039c8a9c6772d38558df Mon Sep 17 00:00:00 2001
From: "taekeun.kang"
Since:
@@ -1197,16 +1195,6 @@ This data is the message that the sender wants to send and its length must be le
Since:
3.0
- Since:
- 3.0
- Code example:
-If the application is connected, the push service passes the notification data over
-the connection. Otherwise, the push service posts a UI notification with the data.
-It will be delivered when a user launches the application by selecting the posting.
-
To receive push notifications, follow the steps below:
-To use Push features, you must register to the Push service.
+For more information on the Push features, see Push Guide.
-For more information on the Push features, see Push Guide.
+To use Push features the application needs the permission to access the Tizen Push servers.
+Service Limitation:
Since:
@@ -48,8 +49,14 @@ For more information on the Push features, see
-
+ Since:
+ 3.0
+ Remark :
- In order to use the push messaging service, see the native Push Messaging Guide.
+ In order to use the push messaging service, see Push Guide.
Parameters:
+The connect() method must be called before calling the register() method.
+
Privilege level:
public
@@ -307,16 +353,19 @@ AbortError - If the operation cannot be finished properly.
Privilege:
http://tizen.org/privilege/push
Remark :
+ In order to use the push messaging service, see Push Guide.
+ Parameters:
with error type SecurityError, if the application does not have the privilege to call this method.
+ with error type InvalidStateError, if the application is not connected to the push service.
+
+ with error type AbortError, if the operation cannot be finished properly.
+ Output example: Output example:
/* Defines the connect success callback */
@@ -1219,7 +1207,6 @@ function notificationCallback(noti)
console.log(' - message: ' + noti.message);
console.log(' - session: ' + noti.sessionInfo);
console.log(' - request ID: ' + noti.requestId);
- console.log(' - type: ' + noti.type);
}
/* Requests for push service connection */
@@ -1234,7 +1221,6 @@ tizen.push.connectService(notificationCallback);
- message: alertMessage=Hi
- session: 002002
- request ID: 23
- - type: 1
+
+
+
+
+PushRegistrationStateChangeCallback
+
+
@@ -124,6 +139,25 @@ For more information on the Push features, see
+PushNotificationCallback
1.2. PushRegistrationState
+ enum PushRegistrationState {"REGISTERED", "UNREGISTERED"};
+
+
+ 2. Interfaces
@@ -161,12 +195,17 @@ The tizen.push object allows access to the functionality of the Push AP
optional ErrorCallback? errorCallback) raises(WebAPIException);
void unregister(optional SuccessCallback? successCallback,
- optional ErrorCallback? errorCallback) raises(WebAPIException);
+ optional ErrorCallback? errorCallback) raises(WebAPIException);
void connectService(PushNotificationCallback notificationCallback) raises(WebAPIException);
+ void connect(PushRegistrationStateChangeCallback stateChangeCallback,
+ PushNotificationCallback notificationCallback, optional ErrorCallback? errorCallback) raises(WebAPIException);
+
void disconnectService() raises(WebAPIException);
+ void disconnect() raises(WebAPIException);
+
PushRegistrationId getRegistrationId() raises(WebAPIException);
void getUnreadNotifications() raises(WebAPIException);
@@ -216,7 +255,7 @@ UnknownError - If any other error occurs.
http://tizen.org/privilege/push
Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
+
The state is changed to: UNREGISTERED
+ Registration succeeded with id: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c
+ The state is changed to: REGISTERED
with error type SecurityError, if the application does not have the privilege to call this method.
+ with error type InvalidStateError, if the application is not connected to the push service. +
+ with error type AbortError, if the operation cannot be finished properly. +
Code example:
+/* Connection to push service should be established (with connect()) and application should be registered (with register()) before calling the code below */ + /* Defines the error callback */ function errorCallback(response) { - console.log("The following error occurred: " + response.name); + console.log("The following error occurred: " + response.name); } /* Defines the unregistration success callback */ @@ -516,13 +601,16 @@ tizen.push.unregister(unregisterSuccessCallback, errorCallback);
connectService
Deprecated. + This function has been deprecated since 3.0. Use the connect() function instead. +
void connectService(PushNotificationCallback notificationCallback);
@@ -539,7 +627,7 @@ tizen.push.unregister(unregisterSuccessCallback, errorCallback);
Remark : If the application calling the connectService() method has not been registered to the Tizen push server, -the register() method must be called before calling the connectService() method. +the registerService() method must be called before calling the connectService() method.
Parameters:
@@ -570,44 +658,142 @@ the register() method must be called before calling the connectServCode example:
-/* Defines the registration error callback */ +/* Defines the connect success callback */ +function notificationCallback(noti) +{ + console.log("Notification received with alert message: " + noti.alertMessage); +} + +/* Defines the data to be used when this process is launched by notification service */ +var service = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/push_test"); + +/* Defines the error callback */ function errorCallback(response) { - console.log("The following error occurred: " + response.name); + console.log("The following error occurred: " + response.name); } /* Defines the registration success callback */ function registerSuccessCallback(id) { console.log("Registration succeeded with id: " + id); + + /* Requests for push service connection */ + tizen.push.connectService(notificationCallback); } -/* Requests application registration */ -tizen.push.register(registerSuccessCallback, errorCallback); +/* Requests registration */ +tizen.push.registerService(service, registerSuccessCallback, errorCallback); ++
connect
+void connect(PushRegistrationStateChangeCallback stateChangeCallback, PushNotificationCallback notificationCallback, optional ErrorCallback? errorCallback); +
+ Since: + 3.0 +
++The ErrorCallback() is launched with these error types: +
++ Privilege level: + public +
++ Privilege: + http://tizen.org/privilege/push +
+Parameters:
+Exceptions:
++ with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter. +
+ with error type SecurityError, if the application does not have the privilege to call this method. +
+ with error type AbortError, if the operation cannot be finished properly. +
Code example:
+/* Defines the state change callback */ +function stateChangeCallback(state) +{ + console.log("The state is changed to: " + state); +} -/* Defines the connect success callback */ -function notificationCallback(noti) +/* Defines the notification callback */ +function notificationCallback(notification) { - console.log("Notification received with alert message: " + noti.alertMessage); + console.log("A notification arrives."); +} + +/* Defines the error callback */ +function errorCallback(error) +{ + console.log("The following error occurred: " + error.name); } /* Requests for push service connection */ -tizen.push.connectService(notificationCallback); +tizen.push.connect(stateChangeCallback, notificationCallback, errorCallback);
Output example:
The state is changed to: UNREGISTERED ++
disconnectService
Deprecated. + This function has been deprecated since 3.0. Use the disconnect() function instead. +
void disconnectService();
Since: - 2.3.1 + 2.1
Privilege level: @@ -624,7 +810,7 @@ tizen.push.connectService(notificationCallback); with error type SecurityError, if the application does not have the privilege to call this method.
- with error type UnknownError, if any other error occurs. + with error type AbortError, if the operation cannot be finished properly.
disconnect
+void disconnect(); +
+ Since: + 3.0 +
++ Privilege level: + public +
++ Privilege: + http://tizen.org/privilege/push +
+Exceptions:
++ with error type SecurityError, if the application does not have the privilege to call this method. +
+ with error type UnknownError, if any other error occurs. +
Code example:
+/* Requests disconnection */ +tizen.push.disconnect(); ++
getRegistrationId
Code example:
+/* Defines the state change callback */ +function stateChangeCallback(state) +{ + console.log("The state is changed to: " + state); + + var id = tizen.push.getRegisterationId(); + console.log("The registration ID: " + id); +} + +/* Defines the notification callback */ +function notificationCallback(notification) +{ + console.log("A notification arrives."); +} + +/* Requests for push service connection */ +tizen.push.connect(stateChangeCallback, notificationCallback); ++
Output example:
The state is changed to: UNREGISTERED + The registration ID: 04a150867a50f48cb79695ac732cbe550b4a6782fffd23cbc14ba8dd5c5ab0025dad29a3e4ef5de8849b95b726bea7a6395c ++
getUnreadNotifications
@@ -746,6 +998,34 @@ tizen.push.connectService(notificationCallback);
tizen.push.getUnreadNotifications();
+Code example:
+/* Defines the state change callback */ +function stateChangeCallback(state) +{ + console.log("The state is changed to: " + state); + + if (state === "REGISTERED") + { + /* Gets unread push notifications */ + tizen.push.getUnreadNotifications(); + } +} + +/* Defines the notification callback */ +function notificationCallback(notification) +{ + console.log("A notification arrives."); +} + +/* Requests for push service connection */ +tizen.push.connect(stateChangeCallback, notificationCallback); ++
Output example:
The state is changed to: REGISTERED ++
getPushMessage
@@ -763,8 +1043,7 @@ tizen.push.getUnreadNotifications();
If the application is launched by the push service, the push service is connected when the application is launched. -Therefore, you can get push messages without calling the register() and -connectService() functions. +Therefore, you can get push messages without calling the connect() function.
If the application was not launched by the push service, this method returns null. @@ -834,8 +1113,6 @@ catch (err) readonly attribute DOMString sessionInfo; readonly attribute DOMString requestId; - - readonly attribute long type; };
Since: @@ -918,16 +1195,6 @@ This data is the message that the sender wants to send and its length must be le Since: 3.0
- -- Since: - 3.0 -
Code example:
/* Defines the connect success callback */ @@ -940,7 +1207,6 @@ function notificationCallback(noti) console.log(' - message: ' + noti.message); console.log(' - session: ' + noti.sessionInfo); console.log(' - request ID: ' + noti.requestId); - console.log(' - type: ' + noti.type); } /* Requests for push service connection */ @@ -950,11 +1216,11 @@ tizen.push.connectService(notificationCallback);@@ -1008,8 +1274,56 @@ This success callback is invoked when a push service registration request is sucOutput example:
Notification received on Thu Jan 01 2015 from: xyz.AnotherApp Details: - - data: example data - - alert message: Data from xyz.AnotherApp received - - session: example session info + - data: {id:asdf} + - alert message: Hi + - message: alertMessage=Hi + - session: 002002 - request ID: 23 - - type: 1
[Callback=FunctionOnly, NoInterfaceObject] + interface PushRegistrationStateChangeCallback { + void onsuccess(PushRegistrationState state); + };+
+ Since: + 3.0 +
++This state change callback is invoked when the state of registration is changed. +Moreover PushRegistrationStateChangeCallback would be called at least once, just after connection is established. +
+onsuccess
+void onsuccess(PushRegistrationState state); +
+ Since: + 3.0 +
+Parameters:
+module Push { + typedef DOMString PushRegistrationId; + enum PushRegistrationState {"REGISTERED", "UNREGISTERED"}; + [NoInterfaceObject] interface PushManagerObject { readonly attribute PushManager push; }; @@ -1089,12 +1406,17 @@ To guarantee that the push application runs on a device with the push feature, d optional ErrorCallback? errorCallback) raises(WebAPIException); void unregister(optional SuccessCallback? successCallback, - optional ErrorCallback? errorCallback) raises(WebAPIException); + optional ErrorCallback? errorCallback) raises(WebAPIException); void connectService(PushNotificationCallback notificationCallback) raises(WebAPIException); + void connect(PushRegistrationStateChangeCallback stateChangeCallback, + PushNotificationCallback notificationCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void disconnectService() raises(WebAPIException); + void disconnect() raises(WebAPIException); + PushRegistrationId getRegistrationId() raises(WebAPIException); void getUnreadNotifications() raises(WebAPIException); @@ -1116,8 +1438,6 @@ To guarantee that the push application runs on a device with the push feature, d readonly attribute DOMString sessionInfo; readonly attribute DOMString requestId; - - readonly attribute long type; }; [Callback=FunctionOnly, NoInterfaceObject] @@ -1126,6 +1446,11 @@ To guarantee that the push application runs on a device with the push feature, d }; [Callback=FunctionOnly, NoInterfaceObject] + interface PushRegistrationStateChangeCallback { + void onsuccess(PushRegistrationState state); + }; + + [Callback=FunctionOnly, NoInterfaceObject] interface PushNotificationCallback { void onsuccess(PushMessage message); }; -- 2.7.4