dodevelopnshare


Leave a comment

How to install .bar in BB10 devices (Deployment for clients)

I use to work in BB10 platform also, and in development process, we need to send different builds at different milestones to the client.

In earlier BB devices, we can easily send deliveries to clients by

  • Installing through OTA Link – Create a build (.JAD/.COD) file(s), and deploy it to device using OTA Link.
  • Installing through SDCard – We can copy these files in parallel in some folder in our SDCard and install directly from there by clicking on .JAD file.

Next, If the build was made accurately the installation process initiate this way and now we have our app running in client’s device/phone.

deploy
Installing through App World Sandbox – upload the file to the vendor portal and keep in in draft mode and then add peoples BBID to the sandbox and then they can download it via BB World. (
http://docs.blackberry.com/en/developers/deliverables/47831/pde1350415869880.jsp)

But, for deploying .bar files for new BB10 devices/Playbook Manager, we can have

For Android Porting Apps –

http://ddpb.dauden.vn/
http://crackberry.com/how-put-android-apps-your-blackberry-10-device


Leave a comment

ProgressDialog in Blackberry

Being a blackberry developer since last 4 years,  I know people face problems to show a Progress Dialog or Wait Screen or Loading Dialog, while execution of some long processing in a background thread.

There are several good examples over the BB Support Forums and StackOverflow pertaining to the above issue. Today, I would like to share the code I use for this. I have 2 classes for this for this functionality.

    1. ProgressDialog extends PopupScreen
    2. ProgressSpinner extends Field
    3. loader.png (attached)

loader

ProgressDialog.java

import net.rim.device.api.system.Display;

import net.rim.device.api.ui.Color;

import net.rim.device.api.ui.DrawStyle;

import net.rim.device.api.ui.Graphics;

import net.rim.device.api.ui.UiApplication;

import net.rim.device.api.ui.component.LabelField;

import net.rim.device.api.ui.container.HorizontalFieldManager;

import net.rim.device.api.ui.container.PopupScreen;

import net.rim.device.api.ui.container.VerticalFieldManager;

public class ProgressDialog extends PopupScreen {

private ProgressSpinner mProgressSpinner;

public ProgressDialog () {

this(Strings.PLEASE_WAIT_TEXT);

}

public ProgressDialog (String text) {

super(new VerticalFieldManager(), DEFAULT_CLOSE);

mProgressSpinner = new ProgressSpinner(true);

HorizontalFieldManager hfm = new HorizontalFieldManager();

hfm.add(mProgressSpinner);

LabelField lblText = new LabelField(text, DrawStyle.HCENTER | FIELD_VCENTER) {

protected void paint(Graphics graphics) {

super.paint(graphics);

graphics.setColor(Color.WHITE);

}

};

lblText.setPadding(0, 0, 0, 5);

hfm.add(lblText);

hfm.setPadding(5, 5, 5, 5);

add(hfm);

}

public void show(boolean show) {

if (show) {

if (!isDisplayed()) {

UiApplication.getUiApplication().pushScreen(this);

mProgressSpinner.startProgressbar();

}

else {

mProgressSpinner.stopProgressbar();

if (isDisplayed()) {

close();

}

}

}

public void paint(Graphics g) {

g.pushContext(0, 0, Display.getWidth(), Display.getHeight(), 0, 0);

super.paint(g);

g.popContext();

}

}

ProgressSpinner.java

import java.util.Timer;

import java.util.TimerTask;

import net.rim.device.api.system.Bitmap;

import net.rim.device.api.ui.Field;

import net.rim.device.api.ui.Graphics;

public class ProgressSpinner extends Field {

private int mFrameCounts;

private int mFrameWidth;

private int mFrameHeight;

private int mCurrentFrame;

private Timer mTimer;

private boolean mIsLarge;

private Bitmap mProgressImage;

private static Bitmap BIG;

private static Bitmap SMALL;

public ProgressSpinner(boolean large) {

mIsLarge = large;

if (BIG == null) {

BIG = Bitmap.getBitmapResource(“loader.png”);

SMALL = Bitmap.getBitmapResource(“loader.png”);

}

mProgressImage = large ? BIG : SMALL;

mFrameCounts = 12;

mFrameHeight = mProgressImage.getHeight();

mFrameWidth = mProgressImage.getWidth() / mFrameCounts;

}

protected void layout(int width, int height) {

setExtent(mFrameWidth, mFrameHeight);

}

public void paint(Graphics g) {

g.drawBitmap(0, 0, mFrameWidth, mFrameHeight, mProgressImage, mCurrentFrame * mFrameWidth, 0);

}

public int getPreferredHeight() {

return mFrameHeight;

}

public int getPreferredWidth() {

return mFrameWidth;

}

public void startProgressbar() {

final ProgressSpinner mProgBar = this;

TimerTask mTimerTask = new TimerTask() {

public void run() {

mProgBar.invalidate();

if (mCurrentFrame == mFrameCounts – 1) {

mCurrentFrame = 0;

}

mCurrentFrame++;

}

};

mTimer = new Timer();

mTimer.schedule(mTimerTask, 0, mIsLarge ? 100 : 200);

}

public void stopProgressbar() {

if (mTimer != null) {

mTimer.cancel();

mTimer = null;

}

}

protected void onUndisplay() {

stopProgressbar();

super.onUndisplay();

}

}

How to use?

ProgressDialog progress = new ProgressDialog ();

progress.show(true); //to show

progress.show(false);

This works awesome. Hope, You will be loving it too…!! Let me know how did it worked for you?


Leave a comment

Twitter API v1 Retired

As, we know Twitter API v1 is retired. We need to move to v1.1.

As the old APIs are retired, I have been facing issue with Twitter – verifyCredentials(). It was throwing IOException due to HTTP Response Code 410.

As, the Twitter APIs are changed, we need to update the Twitter jar, we are using in our applications.

I have got updated Twitter Jar from : https://kenai.com/nonav/projects/twitterapime i.e. twitter_api_me-1.9.

This is working like a charm. Enjoy tweeting with your apps..!! 🙂

Twitter Jar twitter_api_me-1.9 – http://www.mediafire.com/?paxkvjaqnm4bl8c

 


4 Comments

Spy Software for Blackberry 10

As per the fundamentals of Blackberry 10
https://developer.blackberry.com/cascades/documentation/dev/fundamentals/

It was assumed that there is no market for spy software  for Blackberry Smartphones running on OS 10.

But, from below link –
http://devblog.blackberry.com/2013/04/blackberry-jam-unplugged-headless-apps/

it is clear that Blackberry is providing developers –  Background Services framework which allows developers to bundle a separate process with their application to run in the background without a UI.

We can also check the above with release roadmap of BB NDK – http://developer.blackberry.com/native/downloads/roadmap/

So, what does it mean?

It means that apps will no longer require an Active Frame to be open in order to function, That’s what we need to have a spy software.

http://www.berryreview.com/2013/05/20/watch-the-blackberry-jam-session-on-background-services-for-blackberry-10-headless-apps/

I am going to try my hands on above certainly… keep an eye..!!


1 Comment

MultiLevel ListView Demo

This is a sample project to explain about multi level list views in our BB 10 Cascades project. I have used some static JSON files which are bundled inside the project as assets. ListViews displayed here are list of albums, list of songs under an album, and details of a song. This project do not use C++ files for accessing assets, parsing JSON data and populate them at runtime in Screens using QML Only.

  • Create a new Blackberry project in your BB NDK IDE. Select Project Type->”Cascades Application”-> “Standard Empty Project”. Enter Project Name
  • As our application will use some special libraries, we need to add following lines in our Projects “.pro” file

APP_NAME = MultiLevelListViewDemo

CONFIG += qt warn_on debug_and_release cascades

TARGET.CAPABILITY += SwEvent

LIBS += -lbbdevice

LIBS += -lbbsystem

include(config.pri)

Here are some Screenshots of how Screen flows –

I have used 2 Custom Components here:

  1. HeaderTitle – Used as title bar for Screens
  2. MyListItem – Used as List Item for First Level ListView.

Also, you can download the project from here and “Import”->Existing Projects into Workspace->Select archive file->Check Project->Finish.

Download Link : http://www.mediafire.com/download.php?8ql6i92qzwi0pe5


9 Comments

Blackberry Push Technology

What is Push Technology?

http://en.wikipedia.org/wiki/Push_technology

An Overview of Push Technology in Blackberry Platform

https://developer.blackberry.com/services/push/

Some important information related to Push APIs

http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Push-SDK-using-low-level-APIs/td-p/1173007

Basically, we need a Client-Side Application tolisten for Push Messages and a Server-side Application to fire Push Messages.

Server Side Push Application 

private static String password = “Your password here”;

private static String targetURL = “https://pushapi.eval.blackberry.com/mss/PD_pushRequest”;

private static final String APP_ID = “your app id here”;

public static void main(String[] args) throws PushSDKException, BadMessageException, UnauthorizedException {

org.apache.commons.codec.binary.Base64 b6;

//net.rim.pushsdk.acknowledgement.NotificationProcessorServiceImpl nsi;

IdGenerator idGenerator = new IdGeneratorImpl();

List<String> addresses = new ArrayList<String>();

String data = “this is a test message – 2”;

System.out.println(“Data is: ” + data);

addresses.add(“your PIN here”);

PushMessageControl pushMessageControl = new PushMessageControl(idGenerator, APP_ID, addresses);

Content content = new TextContent(data);

PapService papService = new net.rim.pushsdk.pap.PapServiceImpl();

PushSDKProperties properties = getBBProperties();

HttpClientImpl client = new HttpClientImpl();

client.setPushSDKProperties(properties);

papService.setHttpClient(client);

papService.setPushSDKProperties(properties);

PushResponse response = papService.push(APP_ID, password, APP_ID, pushMessageControl, content);

System.out.println(response.getDescription());

}

private static PushSDKProperties getBBProperties() {

PushSDKProperties p = new PushSDKPropertiesImpl();

p.setPpgAddress(targetURL);

p.setHttpIsPersistent(false);

p.setHttpConnectionTimeout(60000);

p.setHttpReadTimeout(120000);

p.setUsingXmlParserDtdValidation(false);

return p;

}

Client Side Application

http://supportforums.blackberry.com/t5/BlackBerry-Push-Development/Simplified-BIS-Push-client-sample/ta-p/693857