About this group

The core value of this group is to bring developers up to speed with BB technology, concentrating on BB10.Exploring efficiency, beauty and power BlackBerry provides to its users by designing Apps that can be used globally and that improves developers life as it improves community life.

Contact Name: Michael Kimathi
E-mail:
  Contact the manager of this GroupSpaces group
Category: Other

News & Announcements

BlackBerry Developer Meet-up September (Built For BlackBerry Revitilized)

  • Saturday, 14th September 2013 at 3:30pm - 8:30pm
    Location: ihub Bishop Magua Building George Padmore Lane Nairobi, Nairobi KE

    Register Here

    • 12 people attended

Built For BlackBerry and Certification

  • Saturday, 3rd August 2013 (all day)
    Location: Ihub 4th Floor Bishop Magua Centre

    Now that everyone is looking forward to build application which qualifies for built for BB We…

    • 45 people attended

TAKE IT TO THE NEXT LEVEL

  • Saturday, 4th May 2013 at 10am - 5:30pm
    Location: IHub Nairobi

    It was amazing to get great ideas hit the floor as we get new developers started as well as…

    • 22 people attended

Previous items

RSS Feed

Create an App for Your Community with BlackBerry

BlackBerry Community App

Last year, we released the BlackBerry Community App, which provides easy access to the BlackBerry Blogs, BlackBerry Forums and BlackBerry BBM Channels. The BlackBerry Forums are powered by Lithium, which offer a REST API to access the forum and is used by the BlackBerry Community App. So how can this help you create an app for your community?

I’d like to announce Community 3, which has been released as open source. Community 3 is a generic version of the BlackBerry Community App that you can customize to access your own blogs, Lithium forum and BBM Channels. The code has been designed to be as “fill in the blank” as possible; just add your own imagery, URLs to your blogs and forums and BBM Channel PINs and you have an application ready to go. The README.md file contains a list of steps to walk you through customizing the application. Extend your community to BlackBerry 10 today!


16 hours ago
Enterprise Push and Pull

Guest post by Sebastian Barthelmess, Senior Enterprise Developer and Architect for BlackBerry

pullpush

A New Type of Enterprise Push

Ok, we all knew it would happen one day. The problem arises that you need to send data larger than 8K to a device. We covered ways to tiptoe around this issue by using the latest compression technologies, but even the best compression is only so good.

What if the REAL problem is you need to send something significantly larger than 8K to a device? What if you still need offline capabilities and streaming is just not an option? Furthermore, if your data is already in a compressed form, like an image in JPG/PNG formats, don’t expect to get it much smaller. If you have grown to love the convenience and security of BlackBerry Push, but just need more scalability, check out this new paradigm – we like to call it “PUSH and PULL.”

Before we explain it in detail, let’s reacquaint ourselves with BlackBerry Push.

Enterprise PUSH as it exists today

  • BlackBerry Push / PAP standards
  • Offline support
  • Guaranteed delivery
  • Any payload type
  • Encrypted end-to-end
  • Runs in background
  • 8K limit

And a quick birds-eye view of our architecture:

pushpull architecture

Envision a small PUSH giving directives for subsequent PULL

This is in essence what we are trying to accomplish. It might look like the following:

  1. Send PUSH request with small payload from App server
  2. BES receives and directs push to device w/ guaranteed delivery
  3. Device receives push metadata
  4. Device PULLS the data from another source

PUSH and PULL has the following features:

  • No file limit size; the device storage is the only restraint
  • Perfect for video transports or large files, content/media delivery systems
  • Guaranteed request, and can check on delivery
  • Simple app / web-services integration
  • May still run in background
  • Asynchronous (more on that later)
  • *Security is up to you

An Example of Push/Pull for the Enterprise

So while the concept of Push/Poke/Pull isn’t entirely new, I noticed I couldn’t find a single example online, so I created one and baked it into the ECL application.

Let’s start by taking a picture for example. A megabyte for a relatively large picture of good quality is quite common. I’ve found a tornado warning picture in the public domain that is pretty close, weighing in at 1.3 MB. Even LZMA compressed at the highest settings, it’s still 1.2 MB. Obviously we have found a good case for Push and Pull.

pushpull image example_tornado

From the ECL example online, there is a code snippet to handle this (starting around line 177):

// Push and Pull Method
pub.getPushPull = function(url) {
               var xhr = new XMLHttpRequest();
               console.log('Getting url: '+url);
               // Attempt to determine filetype from URL
               if(url.lastIndexOf('png')!=-1 || url.lastIndexOf('jpg')!=-1) {
                               console.log('Getting pic!');
                               xhr.open('GET', url, true);
                               xhr.responseType = 'blob';
                               xhr.send();
                               xhr.onprogress = function(evt) {
                                              if (evt.lengthComputable) msg('Loading: '+parseInt((evt.loaded / evt.total)*100));
                               };
                               xhr.onload = function() {
                                              app.pushHandler.picAlert(this.response);
                               };
               }
}

The concept is simple:

  1. Send a URL in your PUSH payload
  2. The Push listener checks for a valid URL before trying to parse JSON and if true fire off “getPushPull”
  3. getPushPull routine goes out and grabs the metadata based on the file type (in this case png or jpg)
  4. Use HTML5 blob response-type to grab it into local storage
  5. Now you call picAlert and show the image.

Go ahead and try it in the latest ECL application in Github. HINT: If you select Tools > Options > Send media push/pull, the app randomly cycles through 4 test urls (including images, ECL data, and video), and then does the pull to the device – all asynchronously without disturbing the user. In fact, you can still navigate the app while the data is being received and watch the status of the download simultaneously! Simply click on the image once received to make it go away.

pushpull screen shot

Just change these URLs to whatever you’d like to test (again in pushHandler.js, around line 162):

   // Mock routine for requesting the URL   pub.getPokePullUrl = function() {    // Have a web service return the url based on your PIN    // Example of an public appserver url to grab a BIG payload...    var url =[     'https://dl.dropboxusercontent.com/u/17100871/ECL/big_list.json',    'http://upload.wikimedia.org/wikipedia/commons/1/1a/Dszpics1.jpg',    'http://www.pdrvirginia.com/wp-content/uploads/2013/10/Virginia-Tornado-Warning1.png',    'http://techslides.com/demos/sample-videos/small.mp4'    ];

You may more realistically push any of these URLs to your device directly from the server interface included in the ECL app. Instead of a JSON payload in the box, pass the URL and the device will display it as an emergency pop up in the app when pushed. Pretty slick indeed.

Now you are no longer limited by the boundaries of Push itself. The sky is the limit! Give it a whirl and reach out to me with any comments or future functionality you would like to see implemented.

Lastly, if you have any problems, reach out to your BlackBerry account manager for assistance.  You are also welcome to tweet me @latestlinux, or comment below.

Links of interest:


5 days ago
Charts with Cascades: Integration through jQuery

The following guest post comes from Alessandro Bellotti, BlackBerry Developer Elite.
In applications that manipulate and display a huge amount of data, it is very useful to integrate charts to provide a better user experience while showing that data to the user.

Currently in Cascades, the Qt class Graph can’t be used. Several solutions have been used, including the use of a background image with overlaying text written by using a Label {}, but this approach never led to optimal results.

Fortunately, thanks to the great flexibility of the BlackBerry 10 Native SDK and to Angelo Gallarello, a member of our BlackBerry Dev Group in Milan who has shown us a great JavaScript library called jQuery Sparklines, we can solve the problem of using graphs in a very simple, fast and effective way.

jQuery is very flexible and easy to use. It supports seven different chart types and all of them are easily customizable.

A very cool feature is the possibility to test the custom parameters in real time thanks to the dedicated box and very detailed documentation on customizing charts.

charts with cascades

The integration into a Cascades project is very easy: the first step is to create an HTML file with a simple text editor. In our case, we name it “grafico.html” and it looks like the following:

charts with cascades_code

Minified can be downloaded here:

Select all the text in the two links and paste between:

<script type=”text/javascript”>  e </script>

of the “grafico.html” file.

To display the graph, you just need to add a WebView to your project (in the QML file that should display the graph), setting its URL to the location of your HTML file.

WebView {
     id: idWebView
     objectName: "idWebView"
     url: "local:///assets/webview/grafico.html"
     verticalAlignment: VerticalAlignment.Fill
     horizontalAlignment: HorizontalAlignment.Fill
}

The next step is to create the string with the values ​​that will be inserted in the grafico.html file to produce the graph.

In our case, I took a SQLLite database, and while rushing records with a Select, I created the string using the method of creating a function callable from the QML in the header file (HPP):

Q_INVOKABLE void readData (QString search);

and a Q_SIGNALS

void gotSparky(QString Sparky);

In CPP, I scrolled the database and for each record found and built the string in the global variable Sparky, maintaining the structure required by the jQuery library.

Finally, after reading all the records, I finished the creation by integrating the Sparky string with Sparky_Full which also contains the parameters for the creation of the chart. So I have set the string in QML “emit gotSparky(Sparky_Full);

void ApplicationUI::readData(QString search)
{
      QSqlDatabase database = QSqlDatabase::database();
      SqlDataAccess *sqlda = new SqlDataAccess(database.databaseName());
      QString appo = search;
      QVariant result = sqlda->execute(appo);
      Sparky_Full = "";
      Sparky = "[";
    if (!sqlda->hasError()) {
        int recordsRead = 0;
        if( !result.isNull() ) {
            QVariantList list = result.value<QVariantList>();
            recordsRead = list.size();
            for(int i = 0; i < recordsRead; i++) {
                QVariantMap map = list.at(i).value<QVariantMap>();
                if (i == 0){
                  Sparky = Sparky +  map.value("quantita").toString();
                }
                else {
                  Sparky = Sparky + "," + map.value("quantita").toString();
                }
            }
            Sparky = Sparky + "]";
Sparky_Full = QString("$('.sparkline').sparkline(")+ Sparky + QString(",{type: 'line', chartRangeMin: '0', fillColor: false, width: '720', height: '250'});");
            emit gotSparky(Sparky_Full);
        }
        if (recordsRead == 0) {
        //  showToast("NO Data!");
        }
    } else {
        alert(tr("Read records failed: %1").arg(sqlda->error().errorMessage()));
    }
}

In the QML file you just need to add a few lines of code. I created two “property” that have the task of checking if the app is already connected to the “onGotSparky” signal (because in that case the data is duplicated), and a support string for the output string coming from the C++ function.

import bb.cascades 1.0
import bb.system 1.0
 
Page {
    property variant connessoSparky:0
    property string sparky_String: ""
 
onCreationCompleted: 
        if (connessoSparky == 0){
            _app.gotSparky.connect(onGotSparky)
            connessoSparky = 1 
        }
            _app.readData(“SELECT * FROM myDataBase”)
    }
 
function onGotSparky(stringa) {
        sparky_String = stringa
}

I put in the evaluateJavaScript() in a ActionItem to keep everything separate. In practice, when onTriggered:{} is issued, the string is passed to the HTML page that elaborates it and gives the graph.

    actions: [
        ActionItem {
            id: actGraph
            title: "Titolo"
            imageSource: "asset:///images/menuicons/ic_chart.png"
            ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
                                 waterWebView.evaluateJavaScript(sparky_String)
            }
        }
   ]

That’s all! Let us know if you have any questions in the comments below, and happy coding!


on 16th April

Create a site like this for your own group.
Take a Tour or Sign Up

Members

Events

April 2014
 
« »
Mon Tue Wed Thu Fri Sat Sun
31 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 1 2 3 4

BlackBerry Devs Kenya

Powered by GroupSpaces · Terms · Privacy Policy · Cookie Use · Create Your Own Group