This is a migrated thread and some comments may be shown as answers.

Push Notifications With Cordova & Icenium - struggling

12 Answers 245 Views
AppBuilder Windows client
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Daniel
Top achievements
Rank 1
Daniel asked on 21 May 2013, 12:31 AM
Hi guys, I am following the blog (by Jim Cowart) but get stuck fairly early.  I am probably just a noob but I have enabled Push Notification plugin for my app and I can see the folder and file  PushNotification.js in my project using graphite. I have also added the push.js file as per instruction but when I run my app in simulator now I get.

  1. Uncaught TypeError: Cannot read property 'pushNotification' of undefined push.js:
  2. GET(cant find) http://local/Simulator/Plugins/PushPlugin/PushNotification.js
This actually makes sense to me because in Index page I have:
<script src="Plugins/PushPlugin/PushNotification.js"></script>
which has green underline telling me it can't find the file.

Anything obvious I am doing wrong (probably applies to all plugins)?

DR

12 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 21 May 2013, 08:29 AM
Hi Daniel,

The green underline and "failed to load resource" error in the simulator are known problems that would be fixed for subsequent update of Icenium. They are not actual errors and you can ignore them.

As for the Push Notifications, the blog post you follow presents detailed instructions with runnable server and application attached to it, you can find them at the end of the blog in the Sample code section. You can use those files, or if you wish to follow the blog, compare the differences between your files and the attached ones.

Greetings,
Steve
the Telerik team

Don't miss the Icenium May Release Keynote - sign up now!
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 10 Sep 2013, 05:24 AM
I download the hybrid push notification example.  I am having some issues with it. If I use the plug in link like  <script src="Plugins/PushPlugin/PushNotification.js"></script>,  the application cannot read the PushNotification.js file.  Then I used the total path to locate the PushNotification.js file. Now it is working for Android. However,  I couldn't register my ios devices. So I need to know why the path src="Plugins/PushPlugin/PushNotification.js is not working. Also what to do for ios devices to register with everlive.
0
Steve
Telerik team
answered on 10 Sep 2013, 07:05 AM
Hi Nahid,

Check out the detailed setup instructions for the Everlive PushNotifications sample in our documentation:Everlive Push Notifications Sample. Also make sure you're running the sample on a real device with provisioned build, as the push plugin does not work in the Icenium simulator or Icenium Ion.

Regards,
Steve
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 11 Sep 2013, 09:00 PM
Hi Steve,
Finally I was able to register my iOS devices. Many thanks for your help. Now my another question: can I send a push notification to a device with hardwareId like below?
el.push.notifications.create({ Message: 'Hello', {Segment: 'HardwareId is *********************'},
             function(data){
                    alert(JSON.stringify(data));
                },
                function(error){
                    alert(JSON.stringify(error));
                }
            );

Actually I am trying to send a push notification from a UI. Therefore, I need to use code like I tried above. What would be the possible way to use segment in code? Thanks for your help in advance.

Best regards, 

Nahid
0
Ivan Pelovski
Telerik team
answered on 13 Sep 2013, 03:12 PM
Hi Nahid,

Push notification segments are described by the Filter field, which should be a serialized JSON literal.Inside the Filter field you can reference the fields of the Devices collection, like Id, HardwareId, etc., including the values in the Parameters field. So here is a sample code for creating a push notification with a segment:
var notification = {
    "Message": "Hello",
    "Filter": "{\"$or\":[{\"Parameters.IntValue\":123},{\"HardwareId\":\"xxxx\"}]}",
    "NotificationDate": "2013-09-26T21:00:00.000Z"
};
el.push.notifications.create(notification,
    function(data){
        alert(JSON.stringify(data));
    },
    function(error){
        alert(JSON.stringify(error));
    }
);


Regards,
Ivan Pelovski
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 13 Sep 2013, 04:15 PM
Thanks Ivan. I also found that example on the everlive.com website, and it solved my problem.
0
Nahid
Top achievements
Rank 1
answered on 02 Oct 2013, 08:44 PM
Hi,
Earlier I successfully implemented PushNotification. Now, I am trying to implement that in my another project. When I added the PushPlugin, I saw icenium changed the plguin.xml file. I am trying to call PushNotification.js file using <script src="PushNotification.js"></script>  in my html file, but it is not working. Even when I printed el.push using alert function, it says it is undefined. What should I do to work with the new plugin.xml file? Any help is much appreciated.

Best regards, 

Nahid
0
Nahid
Top achievements
Rank 1
answered on 04 Oct 2013, 05:47 PM
Hi,
I have manged to implement SMS plugin in my new project. Now I am using fileter in rest api code to send a push notification to a particular target. I am taking input from a UI for a parameter type value. When I first time send a push notification it works. When I change the value of parameter through the UI and send push notification using rest Api, it does not work. I checked on the everlive sites that both time the message had same id. If I refresh the page, it gets a new id and can send which is not fulfilling my purpose. I want to use the UI to send more than one push notification without refreshing the page. In other language, how can I get a new id for my push notification everytime, so that it does not conflict. If I am not clear with my question, please let me know that.

Best regards, 

Nahid
0
Lyubomir Dokov
Telerik team
answered on 11 Oct 2013, 08:47 AM
Hello Nahid,

As far as I understand, you are using some custom UI to send push notifications from Everlive. You are using our REST API to send the notification to Everlive. Is this correct?

If yes, can you please share the code that makes the request to Everlive to create notification? Are you using some of our SDKs or doing the REST call by yourself?


Regards,
Lyubomir Dokov
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 11 Oct 2013, 05:33 PM
Hi Lyubomir,
Yes I was using REST API, and that part is working now. Many thanks for your reply. However, still I couldn't make push plugin 1.3.3 with cordova 3.0.0 functioning.  The icenium hybrid push notification example is still with the push plugin 1.2.2 version. I created a blank project where I added the new push plug in. I followed all code specification that I did with the old version. However, it says el.push is not an object in the line var currentDevice = el.push.currentDevice(emulatorMode); . I saw new blank project is using everlive.all.min.js, but the hybrid push notification example is using everlive.min.js file. I copied everlive.min.js file to my new project. Now it can recognize el.push as an object, but then goes to the function(err) part of currentDevice.enableNotifications(pushSettings) function. Any idea or suggestions?

Best regards,

Nahid  Shah
0
Lyubomir Dokov
Telerik team
answered on 18 Oct 2013, 06:03 PM
Hello Nahid,

We haven't tried those exact versions of cordova and the push plugin, there could be some problem there. We will test and I will let you know what we found out. In the meantime, can you switch at least the push plugin version to the one we tested? This will let you continue your work until we find the problem.


Regards,
Lyubomir Dokov
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 18 Oct 2013, 06:22 PM
Hi Lyubomir,
I went back to cordova 2.7.0 and push push plugin 1.2.2 which is working properly for push plugin. I am also using everlive.min.js file not the everlive.all.min.js file which was not working properly with el.push.currentDevice() function.

Many thanks for your reply. Looking forward to see any future updates in this matter.

Best regards,

Nahid 
Tags
AppBuilder Windows client
Asked by
Daniel
Top achievements
Rank 1
Answers by
Steve
Telerik team
Nahid
Top achievements
Rank 1
Ivan Pelovski
Telerik team
Lyubomir Dokov
Telerik team
Share this question
or