BB10 Push notification: PushPayLoad

I'm developing a c# application that can send a push notification to BB10 devices using Blackberry Internet Service, I found a code it works well, however I don't know how to add custom to the push, data data that can be access with the push as pushPayLoad and used that is when user click on the push notification , it will run my native application bb10 then navigate to the user window or any other open window as required bussiness

Here are my c# code:

HttpWebResponse HttpWRes = null;
            HttpWebRequest HttpWReq = null;

            string pin = "push_all";
            string applicationID = "ApplicationID";
            string BOUNDARY = "ASDFaslkdfjasfaSfdasfhpoiurwqrwm";
            string msg = "Good morning"; // the message to send

            string userName = "ApplicationID";//"YOUR_APPLICATION_ID";
            string userPW = "YourPassword";//"YOUR_PASSWORD";

            string url = "https://pushapi.eval.blackberry.com/mss/PD_pushRequest";

            HttpWReq = (HttpWebRequest)WebRequest.Create(url);

            //SetProxy(HttpWReq); //if proxy needed, use this

            HttpWReq.Method = ("POST");
            HttpWReq.Accept = "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2";
            HttpWReq.KeepAlive = true;
            //HttpWReq.Credentials = new NetworkCredential(userName, userPW);

            HttpWReq.PreAuthenticate = true;
            HttpWReq.ContentType = "multipart/related; boundary=" + BOUNDARY + "; type=application/xml";

            SetBasicAuthHeader(HttpWReq, userName, userPW);
            StringBuilder dataToSend = new StringBuilder();

            dataToSend.AppendLine("--" + BOUNDARY);
            dataToSend.AppendLine("Content-Type: application/xml; charset=UTF-8");

            dataToSend.AppendLine("");
            dataToSend.AppendLine("http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd\">");
            dataToSend.AppendLine("");
            string myPushId = DateTime.Now.ToFileTime().ToString();
            string deliverBefore = DateTime.UtcNow.AddMinutes(5).ToString("s", System.Globalization.CultureInfo.InvariantCulture) + "Z";
            dataToSend.AppendLine("");

            dataToSend.AppendLine("
"); dataToSend.AppendLine(""); dataToSend.AppendLine(""); dataToSend.AppendLine(""); dataToSend.AppendLine("--" + BOUNDARY); dataToSend.AppendLine("Content-Type: text/plain"); dataToSend.AppendLine("Push-Message-ID: " + myPushId); dataToSend.AppendLine(""); dataToSend.AppendLine(msg); dataToSend.AppendLine("--" + BOUNDARY + "--"); dataToSend.AppendLine(""); Stream requestStream = null; string pushResult = ""; try { requestStream = HttpWReq.GetRequestStream(); } catch (Exception ex) { pushResult = "Push failed! " + ex.ToString(); } byte[] outStr = new UTF8Encoding().GetBytes(dataToSend.ToString()); requestStream.Write(outStr, 0, outStr.Length); requestStream.Close(); try { HttpWRes = (HttpWebResponse)HttpWReq.GetResponse(); } catch (Exception ex) { //push failed } if (HttpWRes != null) { HttpWRes.Close(); }

What are the changes that I must code to send data as well as the thrust as profileId = 123?

After much trial and error, I finally found the answer: adding "msg" I can add all payload elements I want:

MyStringBuilder.AppendLine ("profileId"+":" + "AAB123");

MyStringBuilder.AppendLine ("postId"+":" + "4567");

MyStringBuilder.AppendLine (msg);

Tags: BlackBerry Developers

Similar Questions

  • Android.cfg file not created - BB10 Push Notification

    I'm enbaling push notification in my android app BB10 runtime. I'm following this doc to implement the push. I developed the Android using Novell project. I tried different ways to create the file cfg under bar.

    1. Before you create the apk, added the cfg file in the root of the project name of the application (tried naming as android.cfg also).
    2. Using this apk, I generated the .bar file, but Android folder, res folder and apk file do not exist, cfg file is not exist.
    3. Then I tried to add file cfg under bar file after you have created the apk but before signing bar leader, but I started getting the following error:
    Error: No manifest.
    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:606)
            at net.rim.tools.signing.SigningMain.main(SigningMain.java:72)
    Caused by: java.lang.Exception: java.lang.RuntimeException: No manifest.
            at net.rim.device.codesigning.barsigner.BarSigner.if(Unknown Source)
            at net.rim.device.codesigning.barsigner.BarSigner.main(Unknown Source)
            ... 5 more
    Caused by: java.lang.RuntimeException: No manifest.
            at net.rim.device.codesigning.barsigner.BarSigner.try(Unknown Source)
            ... 7 more
    

    I see a lot of post where push is activated with success in app Android Runtime BB10. What I'm doing wrong here?

    Hey Subha_Murali,

    Follow the instructions on this page or complie the sample application. It always works for me flawlessly!

  • Android.cfg BB10 push notification problem

    Hello, I have a real problem to make this android.cfg to put in the app.bar file is created but in white and when I try to put it manually with a zip or rar to change, I got an error like the .bar is broken, can someone tell me the correct form for this archive works and not to put it manually?

    PS: I'm in Eclipse, a porting android with MCG. I just want to make the archive to create with the server info I put in root next to the manifesto and alaso tried to put next to the apk in the bin folder.

    Thank you for your response rincethomas33, I couldn't find your way, but I found the tool that you sign the .bar you can put the 'myapp.cfg' configuration settings in advance

    Thanks again for your response.

    Ricardo Marquez

  • BB10 - personalization of Push Notification

    Hi all. Recently, we test an app with our client. The application will receive push notification when there is new claim being created so that the user can be notified and then they can approve/reject the claim.

    When comes the push, there is asterisk on the app, reduced app icon and also a message will be sent to the hub. But the feedback from users during the tests, they prefer to be

    1. have the asterisk on the app icon / minimized app but do not have the message sent to the Hub

    2. If a user clicks on a message to display in the hub, it will remove the message current and later in the hub

    Is it possible to do?

    For no 1, I tried not to call Notification in app.textConversionCallback, so there is no message in the hub, but that stop the asterisk appears on the application icon.

    app.parsePayload = function (){
        try{
            if (app.pushService !== null){
                var pushPayload = app.pushService.extractPushPayload(app.onInvokedInfo);
                app.blobToText(pushPayload.data, "UTF-8", app.textConversionCallback);
                app.onInvokedInfo = null;
            }
        } catch (err) {
         alert("Was unable to parse the invoke request.");
      }
    };
    
    app.blobToText = function (blob, encoding, callback) {
        var reader = new FileReader();
        reader.onload = function(evt) {
            // No errors, get the result and call the callback
            callback(evt.target.result);
        };
    
        reader.onerror = function(evt) {
            app.debug("Error converting Blob to string: " + evt.target.error);
        };
        reader.readAsText(blob, encoding);
    };
    
    app.textConversionCallback = function(str) {
        //try to disable this but push is not working
        //notify.hub(str);
    };
    
    var notify = {};
    
    // Add a notification in the Hub
    notify.hub = function(str) {
      var mclaim = JSON.parse(str)
      {
        if(mclaim.empno)
        {
          var pushCount = parseInt(mclaim.workqcnt);
          if((pushCount > 0) && (pushCount > 1))
          {
            var title = "Pending Claims Notification";
            var isAre = "are";
            var claim = "claims";
          }
          if((pushCount > 0) && (pushCount == 1))
          {
            var title = "Pending Claim Notification";
            var isAre = "is";
            var claim = "claim";
          }
          var content = "There "+isAre+" "+parseInt(pushCount)+" "+claim+" pending for approval.";
          new Notification(title, {body: content});
        }
      }
    };
    

    Regarding No 2, is there a function perform the delete action?

    All advice or suggestion will be greatly appreciated.

    Update on the app icon is directly related to the Notification of the HTML5; It is impossible to trigger the icon unless you use the Notification of HTML5.

    You may write an extension to access the following Native API to set the badge (i.e. the Update icon) to the application:
    https://developer.BlackBerry.com/native/reference/core/com.QNX.doc.bps.lib_ref/com.QNX.doc.bps.lib_r...

    To remove the notifications in the Hub, you can either:
    (1) create all HTML5 Notifications with the same tag; This will force a notification never exist in the hub, with the most recent notification overwriting previous reviews; or
    (2) keep track of all active notification tags and delete is used to remove unwanted notifications.
    https://developer.BlackBerry.com/HTML5/APIs/notification.html#.Remove

  • BB10 - customization BB Hub and Push Notification Messages

    Hi all.

    The push notification are push to the notification in the hub of BlackBerry. Is it possible for example to create a new label to a custom in the hub application and have the notification being pushed in the custom label?

    No, it is not possible for third-party applications.  Only some apps approved (such as FaceBook, Twitter and LinkedIn) have had access to their own 'space' in the hub.

  • How to configure the push notification in BB10?

    Hi all

    I want to do an application based on the concept of send and receive push notification. I'm having difficulties in your Setup. can anyone describe the steps to configure.

    Thanks in advance.

    Have you watched this...

    http://developer.BlackBerry.com/native/documentation/Cascades/device_comm/push/developing_a_push_ena...

    There are also some examples of applications that illustrate push them...

    http://developer.BlackBerry.com/native/sampleapps/

    After that if you're still stuck, it is better to ask questions of Push in this dedicated forum...

    http://supportforums.BlackBerry.com/T5/BlackBerry-push-development/BD-p/Applications_using_Push_Tech...

  • Apple Push Notification Service production

    I have two applications (just built) that send notifications to and from a web server remotely: everything works fine until yesterday, expiration date of Apple's Push Notifications. I create new certificates (from original CSR files), create a .pem file and download it into my production server, replace the older ones, but when I tested the downloaded Apps from the App Store has not received notifications (in the mode of development that all notifications have arrived properly).

    can someone help me please?

    .. the certificate on my developer account is active (a green dot on the side of Pentecost) and not expired!

    Help

  • Moto G4 - push notifications to stop functioning when the phone is idle / inactive

    Hello!

    I have a very annoying problem with my G4 bike purchased in the UK.

    Problem:

    My push notification comes to app and gmail to stop working when the phone is idle / inactive.

    When I use any application or when I put just the phone side push notifications work fine. They appear on the lock screen and beep.

    After a few minutes of not using the phone, the message to stop the spread. The sender indicates that a tick and the Moto G4 does not show notifications of type push until the phone is activated and unlocked. It is very annoying, because I already missed several attempts to call. This problem occurs with the Wifi or data plan. It is not a What'sApp of settings as it works very well for a while.

    Text messages and phone calls work well, just a data plan seems to go off when idling and never come back until unlocked (even then it takes a while). WiFi seems somehow to maintain a connection.

    I tried:

    • change What settings the sApp
    • disconnection/connection gmail account
    • remove the operating system of the device cache
    • disable the whats of ap battery saving options and all services appear to be relevant
    • WiFi seems somehow to keep the phone, but only data stops immediately, sending fn when idle
    • Restart in safe mode-> the same problem with meeting places. WiFi seems to work, data plan do not when idling

    Is this a known issue? Everyone knows the problem? To me, it seems that the camera seems to move from the internet and do not reactivate until this that unlocked.

    Any suggestion would be appreciated,

    Thank you!

    It seems to work now after clicking: 'Reset the settings App' in the top menu right in "parameters - apps-> gear-> battery optimization"!

    I haven't seen this solution anywhere else. I did the reset done only because I tried to disable optimization for almost all applications gradually. Without success, I clicked on 'Reset the settings App' and suddenly push notification for all work! Yes!

  • Push notifications don't work properly

    Hello! Ive had a problem with my notifications push on incoming messages in Whats App, Hangouts, messaging applications.
    I get no notification either when z3 is in "sleep" or active. Moreover, I only receive new messages when I open a respective application. Even if I have it running but not active at the moment, I don't get notifications unless I have switxh to the app and check a cat or an Inbox manually. Please help solve the problem.

    In this case, there could be a problem with your APN settings. See the following:

    https://talk.sonymobile.com/T5/Xperia-Z1-Z1s/Sony-Xperia-Z1-push-notifications-problems/m-p/522571#M...

  • Acceleration of approval of push notification service

    I wonder if there's a place I can reach out to the acceleration to the top of my push notification service application. Five days seems a bit long to test the existing integration with my Android build.

    Anyone has any advice to help get things moving?

    I checked with the team to push and all pending requests have been processed.  Then you should be all set.  If you have not received notification, check your spam filter in case the message was taken there.

  • How to make the push notification as APN (notification of transmission of apple) with Blackberry API

    Hi all

    I want to know how to get push notification as we APN. I found a demo in the code example of RIM named "httppushdemo" with the server and client code.

    It works this way,

    My custom server (java servlet) push a few data for some static ip (on MDS with given port), on my desk and the BB device receive the MDS data, where my blackberry MDS Simulator is on. So in this case I got direct push notification when the application is activated.

    Flow for Simulator is so as:

    Server customized---> MDS (with specific ipadrees / port)<-------------- >

    (do)                                                              (receive the push)

    But my question is that, in the event of a real device, I have MDS to push the text to the specific ip address.  I have MDS in my device itself. So from where custom server I need to push the text?

    Direct to device? if yes then please tell me where I can change my bb device ip address. ?

    Thanks in advance,

    Tejas

    The AFN is similar to the notion of PPG in BlackBarry who is world BES MDS or Service of Push BlackBerry World BIS. Http you post your button to one of the PPG and it routes the message to the device for you.

    Keep in mind when you push user push BIS and BES that push you to the device with address e-mail or a PIN that you can push only per SPINDLE.

  • It has Blackberry support Push Notification (aka Google PN) 10

    Dear supporters,

    We develop game for BB 10, coding only with native code without using a waterfall.

    We want to apply Push Notification service (aka Google PN).

    But I can't find any information guide how to do this.

    I mean PN using native code, not cascase.

    Please help me to confirm that this is supported or not? If have, please give me more details

    Kind regards

    Hello

    We have C push API. Here's the documentation explaining how they can be used:

    https://developer.BlackBerry.com/native/documentation/core/developing_push_enabled_application.html

  • Push notification by using the credentials of the Production

    Using credentials given by BB Push notification team, I send you notification on the device. But get send status SUCCESS and does not notice on BB device (client).

    It worked very well with credential assessment earlier. I am currently train with Production credentials

    Please, help me in this.

    Note: BIS is on my device.

    Thank you

    I had the question. It was matter of time zone. I am in India & is my servier in the United States...

    Now I get the notification.

    Thanks for responding.

  • BlackBerry app Push Notifications using PushWoosh does not receive notifications when closed and in the background

    I'm developing an application of crossed with phonegap and Jquery mobile platform. I'm trying to implement push notifications for the blackberry application using PushWoosh.

    I noticed that I'm not able to receive notifications when the application is in the background, or when it is closed. I get notifications only when the application is in the foreground.

    Any suggestions on this problem?

    I can use all the help.

    The app is a phonegap application Webworks.

    Thank you.

    Info:

    PhoneGap 2.8.0

    jQuery 1.9.1

    jQuery 1.3.1 Mobile

    SDK WebWorks

    PushWoosh

    Hello

    We just push our BB HTML5 / Webworks sample to our github repo:

    https://github.com/shaders/push-notifications-SDK/tree/master/SDK%20Sample%20Projects/BlackBerry-htm...

    Team Pushwoosh

    www.pushwoosh.com

  • Device not receiving push notifications

    I'm trying to use push essentials.  All my messages received a '1001' with a description of:

    "The request has been accepted for processing, but the final outcome is not yet known. This code is used in response to a request to indicate that the message was received by the PPG and seems to be well formed and valid. »

    However, the messages do not reach the device.

    I was able to reproduce the same behavior using the "low-level-sample" is a part of the push SDK service.  I can see the data arrows in the upper right flashes each time a push notification is sent, but no real message is received.

    My devices appear as active in the menu "subscription request".

    Thank you.

    Please try to use the sample client application developed for pre - 5.0 devices. First of all, you will have to remove all other applications using the same port to push the device. Once the pre - 5.0 sample is run, you will be able to debug to ensure that the device is registered and you can listen to all incoming messages.

Maybe you are looking for

  • Firefox has stopped working all the

    I just tried to open Firefox as usual and it won't work. When I click on a new web address is trying to load it reloads the initial page even. An update has been installed previously and it seems to have stopped working. Is it possible to revert to t

  • How to read the DHT22 of Arduino

    Hi, I am a beginner and I don't know how you could read a sensor of DHT22 of a Serial USB which is connected to the Arduino and making a certain amount of humidity, the LED light lights up. It is even possible to acquire data of sensor of DHT22 like

  • Aurora R5 - failure of the OC - Ubuntu

    Hello My problem seems that so similar to http://en.community.dell.com/owners-club/alienware/f/3746/t/19987400. My setup I7 - 6700 k FE GTX 1080 16 GB of ram of FURY 2400 (xmp ready) 850PSU (liquid cooled) I'm not using windows install HDD, I install

  • My DVD device has "disappeared" from the COMPUTER screen page and is unusable/unrecognisable. Just gone.

    I am running Vista.  My DVD drive is an Optiarc DVD +-RW AD - 5560 a ATA DEVICE.  This has happened in the past, I think that as a direct result of the execution of "update".  I am not very computer but I think it has something to do with the filters

  • Empty database schema field JDeveloper 12.1.3 create an entity dialog object

    Hi allI use JDeveloper 12.1.3:Oracle JDeveloper 12 c 12.1.3.0.0Studio Edition Version 12.1.3.0.0Build JDEVADF_12.1.3.0.0_GENERIC_140521.1008.SThe IDE version: 12.1.3.0.41.140521.1008Product ID: oracle.jdeveloperProduct version: 12.1.3.0.41.140521.100