OpenEdge.Mobile.PushNotificationService

Posted by Roger Blanchard on 23-Sep-2014 12:48

I am attempting to use the PNS as documented. When I call the SendNotification method (oPushService:SendNotification(cMessage, iBadgeCount) ) the following error is thrown;

Does anyone know what this error means? It looks to me lie the API key is not being found. I grabbed this key from the MAB under the TAB push notifications.

Any ideas?

All Replies

Posted by Anil Kumar on 23-Sep-2014 15:06

Hi Roger,

Yes. Push API needs to be taken from the Mobile App Builder located under 'Push Notifications' tab.

         Push Notifications -> <Push Database> -> Open -> Settings -> Push API key

However, as per the error it seems there is problem with connecting to Push server.

Were you able to send push messages directly from the Mobile App Builder's Push Page?

         Push Notifications -> <Push Database> -> Open -> Send push notification

- Choose type of device

- Provide badge and message and click on Send

Thanks and Regards,

Anil Kumar.

Posted by Roger Blanchard on 23-Sep-2014 17:29

Anil,

I can send push messages from withing MAB just fine and they are received by my devices. I just verified I am using the correct api key but I still cannot send from within ABL.

Posted by Sanjeva Manchala on 24-Sep-2014 00:10

Hi Roger,
 
You are receiving this error due to PushNotificationService is registered with wrong URI (api.mobile.rollbase.com). Please register your PushNotificationService with the proper URI (api.appdesigner.rollbase.com) and try from ABL code. I have tried this and it’s working properly. This is a bug in documentation, document showing the URI as ‘api.mobile.rollbase.com’. I have logged a bug (PSC00314706) for documentation to update theURI.
 
Hope this helps,
Sanjeev.
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: 23 September 2014 PM 11:19
To: TU.Mobile@community.progress.com
Subject: [Technical Users - Mobile] OpenEdge.Mobile.PushNotificationService
 
Thread created by rblanchard

I am attempting to use the PNS as documented. When I call the SendNotification method (oPushService:SendNotification(cMessage, iBadgeCount) ) the following error is thrown;

Does anyone know what this error means? It looks to me lie the API key is not being found. I grabbed this key from the MAB under the TAB push notifications.

Any ideas?

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Roger Blanchard on 24-Sep-2014 06:42

Hi Sanjeev,

It works great when using the correct URI.

Thanks.

Posted by Roger Blanchard on 24-Sep-2014 09:56

Anil/Sanjeev,

I am looking in the MAB under databases. I can see the devices and there is a DeviceId. Where does this come from?I assume the mobile device but where? It does not appear to match the device.uuid. I assume this would be the deviceid used in the request when registering a device.

Posted by Roger Blanchard on 24-Sep-2014 09:59

There is also a token as well that is in the request. I can also see a value for this in the MAB push database. Where does this come from?

Posted by Anil Kumar on 24-Sep-2014 10:16

Hi Roger,
 
When we install specific mobile app natively onto device an entry is made into the Mobile App Builder’s database (as part of the device registration API) specifying the deviceID and the token information.
The information about the device (including the deviceId and token parameters) will be saved in the Devices collection of the linked database as soon as the device is running the specific mobile app.
 
The deviceID is different from that of the device UUID. The UUID is an Universal Unique Identifier and the details of how an UUID is generated are determined by the device manufacturer and specific to the device's platform/model.
 
Hope this helps.
 
Thanks and Regards,
Anil Kumar.
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: Wednesday, September 24, 2014 8:26 PM
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] OpenEdge.Mobile.PushNotificationService
 
Reply by rblanchard

Anil/Sanjeev,

I am looking in the MAB under databases. I can see the devices and there is a DeviceId. Where does this come from?I assume the mobile device but where? It does not appear to match the device.uuid. I assume this would be the deviceid used in the request when registering a device.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Roger Blanchard on 24-Sep-2014 10:24

I am looking at documentation that discusses creating a registration service to register a device. The following are request parameters that need to be sent:

* type = "I" for iOS and "A" for Android

* X-Progress-App-Id - I assume this is the api key?

* token - do I have access to send this?

* deviceid - do i have access to send this?

Are core app is an on premise app.The mobile app will work against a customers server that is on premise. We would like to send push notification to the mobile app filtered by customer install. I thought I could use the token to do this but it looks like I cannot.

Posted by Peter Judge on 24-Sep-2014 12:58

Roger,

Off the top of my head (my test project seems to have been migrated away :( )

X-Progress-App-Id is the guid of the project

deviceId you have to get from the device - there's an API for that you can call via a trigger.

You can add fields to the notification database of any type and use values in those as filters when calling the push notification service (the ABL classes have the capability to add generalised filtering). You would have to update the device info with those values. Probably from the device but you could send the device ID to the ABL server together with the user's login info and have the ABL do it.

The ABL push notification  service (broadly-speaking) could be extended to add the device registration and management APIs, but that's not currently planned. Please add an Idea, if you're interested in that.

-- peter

Posted by Roger Blanchard on 24-Sep-2014 14:56

Peter,

You look to be correct for the X-Progress-App-Id. If I compare that value from the notification database to that of the mobile app guid it matches.

DeviceId - what API is that. I have access to the device.uuid but that is not what is being sent. Is there documentation for this API?

Add fields to the database. That is cool so I can add whatever I want so I can filter by this.

As far as registration I was referring to more on the mobile app side so when the app initializes we would send deviceid, token, etc. and register the device in the notification database. I then would be able to sen push notifications and use any of those values to filter.

I have been toying with filter using the ABL classes. The sample from the docs works great.

ASSIGN oPayload = PushNotificationMessageBuilder

:Send(cMessage, iBadgeCount)

                   :IncludeDevice(cDeviceId[1])

                   :IncludeDevice(cDeviceId[2])

                   :IncludeDevice(cDeviceId[3])

                   :Payload.

This crashes the ABL;

ASSIGN oPayload = PushNotificationMessageBuilder

:Send(cMessage, iBadgeCount)

:AddStringFilter ("token", "7b2a2ee7a59ba5c2d452b204ff2d391e5f4936f204dc6d93ce5e998b009fa9e4", OpenEdge.Mobile.PushNotificationFilterOperandEnum:Equals )

:Payload

.

I have a call open with PTS.

Posted by Peter Judge on 24-Sep-2014 16:21

> DeviceId - what API is that. I have access to the device.uuid but that is not what is being sent. Is there documentation

> for this API?

device.uuid sounds about right.  I'll dig a little further to make sure that's what I thought.

>  Add fields to the database. That is cool so I can add whatever I want so I can filter by this.

Ain't it :)

Well since that crash results from code I wrote, you may soon be hearing from me :) - although the AVM should never crash.

-- peter

Posted by Roger Blanchard on 25-Sep-2014 08:04

Peter,

I do not think it is the device.uuid. That is not what is being added to the push database. I also read in phonegap docs that you cannot count on that being the same for iOS. Each time you uninstall/reinstall your app it can change. I tested that many months ago and can confirm that the uuid does change.

I sent sample code to PTS (Ken) that reproduces the crash.

Posted by Roger Blanchard on 25-Sep-2014 12:28

Can someone clarify where the deviceID in the push notification database is coming from?

On my iPhone5 I have the following;

Phonegap reports device.UUID of 299BDA54-C30E-405D-85E5-E0AA0729AC1F    (IT CHANGES EACH TIME COMPLETELY REMOVE APP AND RE-INSTALL)

iTunes reports UDID of 260e2204959df8158d0cc34067f53773eb7cbf92 (THIS SHOULD NEVER CHANGE but I do not think we have access to this value)

In push database I have a deviceID of D34011E8-DD00-428F-A9C6-B9C6200316CA (APPEARS TO STAY THE SAME EVEN AFTER ININSTALL/REINSTALL)

UUIDViewer reports UUID of FFFFFFFFBFEF6419E22A4FA690FDC54B8C577513

Also,

When you enable push notifications for your app it appears the mobile app is registering the device in the push notification database automatically. I would like to add addl fields to the PN DB as Peter mentioned and send the values during registration.

Posted by egarcia on 25-Sep-2014 15:27

Hello Roger,

Just some quick feedback regarding UDID.

>> FFFFFFFFBFEF6419E22A4FA690FDC54B8C577513

The UDID is a 40-digit identifier.

The value that returned by UUIDViewer is not valid. It starts with FFFF.

(The API to get the UDID was deprecated for privacy reasons. Some apps were tracking users from app to app.)

You can get the UDID by using CTRL-C on Windows or Command-C on Mac on Serial Number field in iTunes.

See the following links for some screenshots: indude.com/find-iphone-udid-206

I hope this helps.

Posted by Roger Blanchard on 25-Sep-2014 17:07

Thanks Edsel...I have seen similar articles about the UDID. Do you know what the mobile app sends to the push notification database when registering. There is a deviceID but it does not match any of the ids I have access to.

Posted by Peter Judge on 26-Sep-2014 07:53

Hi Roger,

One of the engineers on the mobile project (Sergey) has the answer, I believe. See below:

-- peter

You can not see device id, in settings of your device, or in iTunes.
For retrieving Device ID, you should use cordova-push-notification plugin  (https://github.com/mgcrea/cordova-push-notification).
If you want use it in application, you can see as we did in our template "Push Notification UserID Settings". 



and page contains following code:
    return encodeURIComponent(localStorage.pushNotificationDeviceID);

And this value passed as deviceID to collection Devices.

Posted by Roger Blanchard on 26-Sep-2014 07:57

This is great...let me give it a try.

THANK YOU.

Posted by Roger Blanchard on 26-Sep-2014 08:24

yeah, it looks like all I need is the encodeURIComponent(localStorage.pushNotificationDeviceID).

thanks.

Posted by Peter Judge on 26-Sep-2014 08:58

Good to know – we need to add that to the doc.
 
-- peter
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: Friday, 26 September, 2014 09:25
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] OpenEdge.Mobile.PushNotificationService
 
Reply by rblanchard

yeah, it looks like all I need is the encodeURIComponent(localStorage.pushNotificationDeviceID).

thanks.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Roger Blanchard on 26-Sep-2014 09:11

I may be incorrect but it appears when you create a new project this cordova-push-notification plug-in is already included in project. If I simply drop a button on a page and add the following javascript alert (localStorage.pushNotificationDeviceID); it will return undefined. My guess is because I did not enable PN under appsettings. If I then enable PN under AppSettings and rebuild project my javascript will return the deviceID.

So, as long as I enable Push Notification the localStorage.pushNotificationDeviceID will be populated.

Is this the same for the token?

Posted by Roger Blanchard on 26-Sep-2014 09:40

Peter,

Just an FYI that template does NOT work for me. I am guessing it is for Rollbase backend. I modified the URL to the following and it works.

api.appdesigner.rollbase.com/.../reg{deviceID}

My guess is all the docs that refer to

api.mobile.rollbase.com need to be changed to api.appdesigner.rollbase.com when using OE. Either that or the template and all the docs are just wrong...not sure.

Posted by Peter Judge on 26-Sep-2014 09:45

Thanks Roger,
 
I'll pass that along too (I suspect you're right).
 
-- peter
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: Friday, 26 September, 2014 10:41
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] OpenEdge.Mobile.PushNotificationService
 
Reply by rblanchard

Peter,

Just an FYI that template does NOT work for me. I am guessing it is for Rollbase backend. I modified the URL to the following and it works.

api.appdesigner.rollbase.com/.../reg{deviceID}

My guess is all the docs that refer to

api.mobile.rollbase.com need to be changed to api.appdesigner.rollbase.com when using OE. Either that or the template and all the docs are just wrong...not sure.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Roger Blanchard on 26-Sep-2014 09:52

Peter,

You mentioned that I can add fields to this push notification database. I have done that and created a new field called deploymentID. I then added a new request parameter called deploymentID and the field is updated in the DB. This is pretty cool!!

Thanks for the help.

Posted by Roger Blanchard on 26-Sep-2014 10:04

The last piece to this puzzle is to allow my mobile app to control the registration process. It appears if you enable push notifications in the app that when you install the app or the first time you run the app the device is registered. Is there any way for me to NOT have this happen?

Posted by Peter Judge on 26-Sep-2014 10:05

No problem at all.  Happy to help.
 
I don't know if you heard back from TS, but you can workaround your crash by splitting the oPayload = call into 2 parts (define a new oBuilder variable and let that do the building of the message and assign oPayload = oBuider:Payload).
 
Hth,
-- peter
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: Friday, 26 September, 2014 10:53
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] OpenEdge.Mobile.PushNotificationService
 
Reply by rblanchard

Peter,

You mentioned that I can add fields to this push notification database. I have done that and created a new field called deploymentID. I then added a new request parameter called deploymentID and the field is updated in the DB. This is pretty cool!!

Thanks for the help.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Roger Blanchard on 26-Sep-2014 10:12

I will give that a try...thanks,

Posted by Roger Blanchard on 26-Sep-2014 10:35

Peter,

That workaround works great...thanks again!!

Posted by Roger Blanchard on 30-Sep-2014 09:41

Peter,

I am using the push plugin as you described in a prior post. This seems to work just fine. However, all of a sudden the PushInit will work but the registration fails. Is it possible the push notification servers could be down sporadically?

Is there anyway to determine in the push registration fail event why it is failing?

My app that was working fine last night will no longer register when it starts...no app changes. It just stopped working. I tried another device...same issue.

Posted by egarcia on 30-Sep-2014 09:47

Hello Roger,

Just some quick feedback.

I wonder if the push notification server was or is unavailable due to some cloud machines being restarted based on a requirement by the infrastructure provider.

Could you contact Technical Support to check if the servers are available?

Thanks.

Posted by Roger Blanchard on 30-Sep-2014 11:24

It appears that Amazon was doing some maintenance..response from PTS below. Should we be able to rely on the PNS being available for our customers?

"The push notification server is hosted on Amazon Web Services. This morning Amazon took down for maintenance several of the servers hosting our mobile services. This may have caused the issue you and I saw, but if it did we do not know the exact mechanism. Progress DevOps restarted the servers, and that cleared up the problem."

Posted by Shelley Chase on 30-Sep-2014 12:00

Hi Roger,

We will check into the server status and whether we knew about the downtime.

Thanks
-Shelley
 
[collapse]
From: rblanchard [mailto:bounce-rblanchard@community.progress.com]
Sent: Tuesday, September 30, 2014 12:25 PM
To: TU.Mobile@community.progress.com
Subject: RE: [Technical Users - Mobile] OpenEdge.Mobile.PushNotificationService
 
Reply by rblanchard

It appears that Amazon was doing some maintenance..response from PTS below. Should we be able to rely on the PNS being available for our customers?

"The push notification server is hosted on Amazon Web Services. This morning Amazon took down for maintenance several of the servers hosting our mobile services. This may have caused the issue you and I saw, but if it did we do not know the exact mechanism. Progress DevOps restarted the servers, and that cleared up the problem."

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by andrew.may on 02-Oct-2014 07:49

Amazon did notify people in advance & there was plenty of talk about it on various tech sites in advance (I don't have any EC2 or Pacific instances & I knew about it).

Here's Amazon's follow-up blog post which provides advice on how to avoid problems if/when reboots occur.

aws.amazon.com/.../ec2-maintenance-update-2

Posted by Biao Wang on 02-Oct-2014 11:21

While Amazon did give us notice about the reboot, we were not given options on how and when the reboot will occur. Unfortunately, we had a design limitation that caused a downtime due to this uncontrolled reboot. We are modifying our deployment architecture to address the limitation right now to avoid future impact to the platform availability due to uncontrolled mass reboot of our systems.  

This thread is closed