Try OpenEdge Now
skip to main content
Online Help
Data Object overview : Tasks : Using the push notification API : Connecting to a push notification server
Connecting to a push notification server
Before sending notifications, you must connect to the push notification server using an instance of the OpenEdge.Mobile.PushNotificationService class. This PushNotificationService requires a URI (representing the server location) and an API key (required to identify the notification sender).
The example below illustrates creating a connection to the push notification server on Telerik server.
Note: Depending on your application design, you may need only a single connection for the duration of your ABL session; a single PushNotificationService instance can send multiple notification messages.
block-level on error undo, throw.

using OpenEdge.Mobile.PushNotificationService.
using OpenEdge.Net.URI.
using OpenEdge.Net.UriSchemeEnum.

define variable oURI as URI no-undo.
define variable cApiKey as character no-undo.
define variable oPushService as PushNotificationService no-undo.

assign oURI = NEW URI('http', '').
cApiKey = "<API key of Telerik backend service>"
oPushService = PushNotificationService:Instance(oURI, cApiKey).

A new URI object is created using a constructor, providing at least the scheme and host. The other elements of the URI can be added using properties (most) or methods (queries).
The push notification service only uses the scheme, host, and port of the provided URI; the other parts are discarded. A URI can additionally be derived from a string using the static Parse() method as shown below.
using OpenEdge.Net.URI.

define variable oURI as URI no-undo.
oURI = URI:Parse('').