How to Download the Attachments from Mail Client in BlackBerry

Hi,

Here i am trying to download the attachment from the E-Mails of the Mail Client. For this, i used the AttachmentHandler API. But using AttachmentHandler API, the three big shortcomings are there:

  1. Attachment name should be prefixed with x-rimdevice
  2. Can download the attachment only from the Messages Application of the phone.
  3. It will return the content type  if the attachment type is not supported by BlackBerry phone like .html or .pdf.

To avoid this shortcomings, i have tried the below code which is really helpful to get the content of the attachment(For me it is html file) and if require, you can parse it also. It will work for Messages and for the other configured Mail client also. As my requirement, the app should start on the start up of the device and the app icon should not display. For this, in descriptor file, i checked Auto-run on start-up  and Do not display the application icon on the BlackBerry Home Screen option.

So please check and use the below code:

</pre>
public class MyApp extends UiApplication {

private AttachmentDownloadManager mDownloadManager;
 private Hashtable tableValues;
 private String mEncData;
 private String mUserName;
 private String mOrgName;
 private String mKeyVersion;
 private String mEPayload;
 private String mSendURL;
 private String mId;
 private String mChallenge;
 private String mAuthToken;
 private String mPin;
 BodyPart bp = null;
 private Store store;
 static MyApp theApp = null;

public static void main(String args[]) {
 try {
 theApp = new MyApp();
 } catch (Exception e) {
 Dialog.alert("Exception e = " + e.toString());
 } finally {
 theApp.enterEventDispatcher();
 Logger.out("MyViewer", "Args Length :" + args.length);
 }
 }

private MyApp() {
 /**
 Add the menu item for the Mail client. It will add for every mail client.
 **/
 ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();
 ApplicationDescriptor app = ApplicationDescriptor.currentApplicationDescriptor();
 SampleMenuItem mi = new SampleMenuItem(app);
 amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_EMAIL_VIEW, mi);
 }

private class SampleMenuItem extends ApplicationMenuItem {

Message msg;
 ApplicationDescriptor app;

SampleMenuItem(ApplicationDescriptor app) {
 super(20);
 this.app = app;
 }

public String toString() {
 return "Open The attachment";
 }

public Object run(Object context) {
 if (context instanceof Message) {
 msg = (Message) context;
 try {
 downloadAttchment(msg);
 } catch (Exception e) {
 e.printStackTrace();
 }
 // TODO Auto-generated method stub
 return null;
 }
 return context;
 }

}

private void downloadAttchment(Message message) {
 mDownloadManager = new AttachmentDownloadManager();
 Multipart multi = (Multipart) message.getContent();
 for (int i = 0; i < multi.getCount(); i++) {
 BodyPart bp = multi.getBodyPart(i);
 //Checking whether the attachment is supported attachment or not
 if ((bp instanceof SupportedAttachmentPart) && (bp.hasMore())) {
 mDownloadManager = new AttachmentDownloadManager();
 String type = mDownloadManager.getFileContentType(bp);
 // checking whether the type of the attachment is html file or not
 if (type.trim().endsWith("htm") || type.trim().endsWith("html")) {
 try {
 mDownloadManager.download(bp, null, new DownloadProgressListener() {

public void downloadCancelled(Object element) {
 // TODO Auto-generated method stub

}

public void downloadCompleted(Object element) {
 // TODO Auto-generated method stub
 BodyPart bpnew = (BodyPart) element;
 startParse(bpnew); // Parse the html file here

}

public void updateProgress(Object element, int current, int total) {
 // TODO Auto-generated method stub

}

});
 } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 }
 }
 }

}

}
<pre>

Hope it will help.
 

 

This entry was posted on November 16, 2012. 1 Comment

Stop the scrolling of the header in the jQuery Mobile

In jQuery, if you add a header, it use to scroll by default with the screen which is not the normal behavior for Android. To fix this, you have to add

data-position=”fixed” in the header div tag. So your header will be look like below:
<div data-theme=”b” data-role=”header” data-position=”fixed”>

Try it..

Make your App Successful

Now a days, App Development specially Mobile App Development is not only become a hot cake in the market, it is helping many of the developer to earn the money in their own way.  But again, before turn your career to a new path and be happy with your app development, which leads you to leave your day job, think deeply. And also follow some thumb rules and plan it.  So before going to the deep, first look on some useful statistics:

  1. Mobile Internet to cross 100 million users in 2012 driven by Smartphone penetration.
  2. More than 50% of the user base are School and college going people.
  3. So here you can check how the internet penetration in India has been changed from last two years and how it is going to be changed:
  4. Now if you seperate the mobile users of this planet it is looking like below:

So if you check the above mentioned statistics, mobile users are increasing drastically. But the most interesting figure is, by 2016, the mobile application business will generate $46 billion in revenue worldwide by  ABI research. So it means a lot to the industry as well as the people who wants to gain money individually from App development.  But a big question is: How can we make it?? That is i am going to clarify here with little description. First, divide the plan in two ways: Business Plan and Technological Plan.   First talk about for business plan:

Business Plan:

  • Build Business, not AppFirst of all, you have to understand that you are building an Business, not an App.  As fast, as you understand this real fact, you will be able to reach the success path in a short period.
  • Build idea, may not be unique: To develop an App, you have require some stunning idea to implement. But don’t think that the idea should be unique. Because there is no idea which is unique. So don’t hesitate and implement it. And try to mix up with more and more useful use cases.
  • Document the idea: Document your idea with all your experience. So that, it will be clear to you while developing the app. So dedicate the time for proper planing and smooth execution.
  • Think about your target audience: If you analyse the above statistics, 37% mobile user is students and 29 % is youths. So build your app looking on their hobbies. It will be easy to categorize the apps in different perspectives: Fashion, Lifestyle, Music or Social life.
  • Add more Smart features : Give your application idea more smarter looks by adding some smart features. Just look on Zomato app in Android. In this app, user can  search the restaurants by shaking just their phone. So this beautiful feature is giving them the opportunity to get more likes.
  • Advertise your upcoming Adds: Advertise your next app by placing House Ads in your current and exiting apps. It will help to reach to the more users.

             Even advertise of your apps can give you more revenue if you execute your business  model in a good way. Take a simple example. Suppose your current app downloaded 500 times in 15 days. If you advertise it properly your next app, it will reach the same number of downloads in 7 days for sure.

  • Listen user feedback:  Listen to your users and and continually test the existing apps. Accept the feedback from your user with open vision and update the app regular basis. Because if you and your app become silent after the release, you will lose more user.
  • Don’t violate user loyalty:  Be loyal to your user all the time. Suppose in your application there is one screen for terms and condition about the app. If the user will agree with those terms and conditions, he will be able to move forward. Now i saw many apps, where the check box is selected before user has to select it. Means you are forcing the user to agree with the terms and conditions. It will really create a bad impression to the user.
  • Go Social : Go social with the apps. Make your app integrated with facebook, twitter or other social platforms. So that it can reach to the more user. For BlackBerry, the apps which are integrated with BBM, is downloaded more 200% than the other apps.
  • Project your approach properly : At last, think about your plan after completing the app. So just think, you want to go with your current app with more more new features and versions or you will do some more apps and publish them in the market. Just think about to big game development brands: Backflip Studio and Rovio. Backflip Studio’s first game Ragdoll Blaster released for iphone. Then they released paper toss which became number 1 free app and downloaded more than 16 million times from market. After that they came with lots of other games and able to monetize their users. . Backflip Studios is now earning more than $100,000 a month with AdMob and mobile advertising is now responsible for approximately 50% of monthly revenues for the company.

But if you think about Rovio, they have only two apps. Angry bird(with different versions) and Amazing Alex. They never think to make  any apps. Because they released different versions of Angry birds for different platforms as well as PCs. Now Rovio’s revenues jump 963% year-on-year to $106.3M in 2011.

So Just stop a while after developing the first app, and think which approach you are going to follow..

Now come to the Technical Plans which will help your app to reach more users.

Technical Plans:  Now come to the Technical Plans which will help your app to reach more users.

  • Make UI smarter and better:  First of all create the application UI more smart and colorful. It does not depends on the platform you are designing the app, whether it is android, iPhone or windows mobile. the stability of apps only depends upon its design, fractures and its UI experience. But it matters, for which purpose you are developing the app: lifestyle, games or business. check the Moodswings  App in iPhone
  • Build app for both orientation :  Whenever making the app, build it for portrait as well as landscape mode. Beside, make it more generic so that it will support maximum devices.
  • Use less permission:  While developing, try to use less permission in your apps. If you build the app with more permissions, user will think multiple times to download it.
  • Integrate help instruction:  Integrate the help pages with the help. It will help to drive the user through out the app easily. This will create a good impression to the user which will help for your next app or next release.
  • Check about the app design:  While building the UI, take care about good design. If you keep the save button in below right and continue button in below left, every time it will mislead the user. Even, try to implement different search patterns like Auto search, sort or auto-complete with nice and sensible touch. So it will help to develop a smooth user experience for your app.

Go with this plans..Make your apps. May be you will be earn some penny out of that $46 billion.  Hope this post will help to build a good and successful app.  Waiting for the comments……….

This entry was posted on September 3, 2012. 2 Comments

customized button in Blackberry

For customizing the button with a background image which will come to focus while touching or pressing the button.

Just include this custom class:

public class CustomButtonImageField extends Field {

// private int backgroundColour = 0x100808;
 private int fieldWidth;
 private int fieldHeight;
 private int buttonHeight;
 private int buttonWidth;
 private String label = "";

private Font font;
 private int color;

Bitmap bmpBackground;
 Bitmap bmpFocussedButton, bmpUnFocussedButton;
 Bitmap buttonImage;

boolean bgImageActive = false;

public CustomButtonImageField(String label, Bitmap img, Bitmap unFocussedbutton, Bitmap focussedButton) {
 super(Field.FOCUSABLE);
 this.bmpBackground = img;
 this.bmpFocussedButton = focussedButton;
 this.bmpUnFocussedButton = unFocussedbutton;

this.font=FontFamily.forName("BBAlpha Sans").getFont(Font.BOLD, 14);
 this.color=Color.WHITESMOKE;

buttonHeight = focussedButton.getHeight();
 buttonWidth = focussedButton.getWidth();
 this.label = label;
 fieldWidth = img.getWidth();
 fieldHeight = img.getHeight();
 buttonImage = unFocussedbutton;

this.setPadding(0, 0, 0, 0);
 }

public CustomButtonImageField(String label, Bitmap unFocussedbutton, Bitmap focussedButton, long style) {
 super(Field.FOCUSABLE | style);
 this.bmpBackground = null;
 this.bmpFocussedButton = focussedButton;
 this.bmpUnFocussedButton = unFocussedbutton;
 this.label = label;
 this.font=FontFamily.forName("BBAlpha Sans").getFont(Font.BOLD, 14);
 this.color=Color.WHITESMOKE;

buttonHeight = focussedButton.getHeight();
 buttonWidth = focussedButton.getWidth();
 this.label = label;
 fieldHeight = focussedButton.getHeight();
 fieldWidth = focussedButton.getWidth();
 buttonImage = unFocussedbutton;

this.setPadding(0, 0, 0, 0);
 }

protected boolean navigationClick(int status, int time) {
 fieldChangeNotify(1);
 return true;
 }

protected void onFocus(int direction) {

VirtualKeyboard virtualkeybrd = UiApplication.getUiApplication().getActiveScreen().getVirtualKeyboard();

if (virtualkeybrd != null)
 {
 virtualkeybrd.setVisibility(VirtualKeyboard.HIDE);
 }
 buttonImage = bmpFocussedButton;

invalidate();
 }

protected void onUnfocus() {
 buttonImage = bmpUnFocussedButton;
 invalidate();
 }

public int getPreferredWidth() {
 return fieldWidth;
 }

public int getPreferredHeight() {
 return fieldHeight;
 }

protected void layout(int arg0, int arg1) {
 setExtent(getPreferredWidth(), getPreferredHeight());
 }

protected void drawFocus(Graphics graphics, boolean on) {

}

public void setFocussedImage(Bitmap focusImage) {
 bmpFocussedButton = focusImage;
 }

public void setBackgroundImage(Bitmap bgImage) {

buttonImage = bgImage;
 invalidate();

}
 public void setBgImgStatus(boolean status) {

bgImageActive = status;

}
 public boolean isBgImageActive() {

return bgImageActive;

}

protected void fieldChangeNotify(int context) {
 try {
 this.getChangeListener().fieldChanged(this, context);
 } catch (Exception e) {
 }
 }

protected void paint(Graphics graphics) {
 if (bmpBackground != null) {
 graphics.drawBitmap(0, 0, bmpBackground.getWidth(), bmpBackground.getHeight(), bmpBackground, 0, 0);

} else {
 graphics.drawBitmap(0, 0, buttonImage.getWidth(), buttonImage.getHeight(), buttonImage, 0, 0);
 }
 graphics.setFont(font);
 graphics.setColor(color);

if (font == BaseScreen.FontFamily.forName("BBAlpha Sans").getFont(Font.BOLD, 20) && label.indexOf('@')>0){
 graphics.drawText(label, 40, buttonHeight / 2, graphics.HCENTER | graphics.VCENTER, buttonWidth);// 0,7,
 }else {
 graphics.drawText(label, 0, buttonHeight / 2, graphics.HCENTER | graphics.VCENTER, buttonWidth);// 0,7,
 }

}
 public void setColorAndFont(Font font, int color){
 this.font=font;
 this.color=color;
 }

public void setImages(Bitmap focussedButton){
 buttonImage = focussedButton;
 fieldWidth = buttonImage.getWidth();
 fieldHeight = buttonImage.getHeight();
 invalidate();
 }
 }

Then use this button in your screen like below:

btncSubmit = new CustomButtonImageField("Login", Bitmap.getBitmapResource("unfocus_btn.png"), Bitmap.getBitmapResource("focus_button.png"), Field.FIELD_LEADING);
 btncSubmit.setChangeListener(this);

Hope it will help.  Cheers.

Moving Sencha Touch 2 to Phonegap

Here i am going to describe the process to set up your environment for Android Development using PhoneGap(Which is now renamed as Corodova) platform. So before that, you should be a sencha touch App developer and should have some knowledge about Android. Hope its there. As Sencha touch 2 is not giving much native functionality like Barcode scaning and all, for more native part we should access the PhoneGap APIs. Now suppose you have a project developed using sencha touch with just basic UI. Now for native phone functionality, you want to move to PhoneGap. So please follow the below steps::

  • Just start Eclipse(Eclipse 3.4+) and create a project named DemoPhoneGap (you can give any other name).
  • Download the latest copy of Cordova and extract its contents. We will be working with the Android directory.
  • In the root directory of your project, create two new directories:
    • /libs
    • assets/www
    • /resources
  • Copy xml folder from your Cordova download earlier to /res in your current project
  • Copy cordova-1.8.0.jar from your Cordova download earlier to /libs
  • Verify that cordova-1.8.0.jar is listed in the Build Path for your project. Right click on the /libs folder and go to Build Paths/ > Configure Build Path.… Then, in the Libraries tab, add cordova-1.8.0.jar to the project.
  • Inside assets/www folder, copy cordova-1.8.1.js file which you downloaded previously.
  • Edit your project’s main Java file found in the src folder in Eclipse
  • Change the class’s extend from Activity to DroidGap
  • the Activity code should look like this:
import android.os.Bundle;
import org.apache.cordova.*;
public class SenchaCameraAPPActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setIntegerProperty("loadUrlTimeoutValue", 60000);
super.loadUrl("file:///android_asset/www/index.html");
}
}
  • Open the Android Manifest file and Paste the following permissions between the <uses-sdk…/> and <application…/> tags.
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
uses-permission android:name="android.permission.VIBRATE"
uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
uses-permission android:name="android.permission.READ_PHONE_STATE"
uses-permission android:name="android.permission.INTERNET"
uses-permission android:name="android.permission.RECEIVE_SMS"
uses-permission android:name="android.permission.RECORD_AUDIO"
uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"
uses-permission android:name="android.permission.READ_CONTACTS"
uses-permission android:name="android.permission.WRITE_CONTACTS"
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
uses-permission android:name="android.permission.GET_ACCOUNTS"
uses-permission android:name="android.permission.BROADCAST_STICKY"
  • Support orientation changes by pasting the folowing inside the <activity> tag.
android:configChanges="orientation|keyboardHidden|screenSize"
  • Open your sencha directory where you created your project. Hopefully it should be inside apache tomcat/webapps
  • In the project, there should be one folder called app.
  • Copy the app folder and paste it inside assets/www folder.
  • Copy app.js file from sencha project directory and keep it inside the app folder of the PhoneGap project. It means copy the file inside assets/www/app
  • Then open the Sencha SDK (sencha-touch-2.0.0-commercial) and copy the sencha-touch-all.js and sencha-touch.js files and paste them inside www/app.
  • Copy all the folders from resources folder of sencha sdk. Paste them inside the resources folder of the PhoneGap project(DemoPhoneGap)
  • Inside resources/css folder, you can find sencha-touch.css file
  • Copy the file and paste it inside assets/www
  • Copy the index.html file from  your sencha project and paste it inside assets/www
  • Copy the below lines inside index.html file(After title tag)
<script type="text/javascript" id="phonegap" src="cordova-1.8.1.js"></script>
<script src="sencha-touch-all.js" type="text/javascript"></script>
<link href="sencha-touch.css" rel="stylesheet" type="text/css" />
  • So now index.html file should look like this:::
<!DOCTYPE html></pre>
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Listview</title>
<script type="text/javascript" src="sencha-touch-all.js"></script>
<script id="phonegap" type="text/javascript" src="cordova-1.8.1.js"></script>
<script type="text/javascript" src="app/app.js"></script><script type="text/javascript">
if (!Ext.browser.is.WebKit) {
alert("The current browser is unsupported.\n\nSupported browsers:\n" +
"Google Chrome\n" +
"Apple Safari\n" +
"Mobile Safari (iOS)\n" +
"Android Browser\n" +
"BlackBerry Browser"
);
}
</script>
</head>
<body></body>
</html>

Now its done. Just try and hope you can see the desired result. Sorry, because in the post codes and text are not properly aligned.


This entry was posted on June 26, 2012. 6 Comments

Scrollable Edit Box for Blackberry

Getting a scrollable edit field is a tough tusk in blackberry. But if you use the below code, you can get it easily.

public class TextBoxWithScrollField extends Manager implements ScrollChangeListener
{
private int nManagerWidth = 0;
private int nManagerHeight = 0;
private String strTxtContent = null;
int nOrientaion = Display.getOrientation();
private VerticalFieldManager vfm = new VerticalFieldManager(VERTICAL_SCROLL | USE_ALL_WIDTH | USE_ALL_HEIGHT);//
private EditField editField;</code>

public TextBoxWithScrollField(String content, int width, int height, int maxChars, long style)
{
super(style | NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL);
editField = new EditField("", "", maxChars, FOCUSABLE);
nManagerWidth = width;
nManagerHeight = height;
strTxtContent = content;
editField.setText(strTxtContent);
editField.setEditable(true);
editField.setPadding(new XYEdges(10, 10, 10, 10));
vfm.add(editField);
add(vfm);
vfm.setScrollListener(this);
}

public TextBoxWithScrollField(String content, int width, int height, int maxChars)
{
this(content, width, height, maxChars, 0L);

}

public void setBgImgWidth(int width)
{
nManagerWidth = width;
}

public void setBgImgHeight(int height)
{
nManagerHeight = height;
}

public String getText()
{
return editField.getText();
}

public void setText(String text)
{
editField.setText(text);
}

public int getPreferredWidth()
{
return nManagerWidth;
}

public int getPreferredHeight()
{
return nManagerHeight;
}

protected void sublayout(int w, int h)
{
if (nManagerWidth == 0)
{
nManagerWidth = w;
}

if (nManagerHeight == 0)
{
nManagerHeight = h;
}

int nActWidth = Math.min(nManagerWidth, w);
int nActHeight = Math.min(nManagerHeight, h);
layoutChild(vfm, nActWidth - 2, nActHeight - 2); // Leave room for
// border
setPositionChild(vfm, 1, 1); // again, careful not to stomp over the
// border
setExtent(nActWidth, nActHeight);
}

public void scrollChanged(Manager m, int x, int y)
{
}
}

Now how you will use this in your code or in your screen?? It is pretty simple..

TextBoxWithScrollField tbsfMsg = new TextBoxWithScrollField("",Bitmap.getBitmapResource("sample.png").getWidth(), Bitmap.getBitmapResource("sample.png").getHeight(),1000);
tbsfMsg.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("sample.png"), 0, 0, 1));
tbsfMsg.setMargin(new XYEdges(10, 0, 0, 10));
tbsfMsg.setEditable(true);
Manager.add(tbsfMsg);

Thats it. Try it. You will get a proper scroll edit box if your edit box background image will be good..

This entry was posted on June 18, 2012. 1 Comment

Lock all folders and apps from opening in Blackberry

Here i am describing how to lock your home screen. Here ‘lock’ means, when i am pressing any folder or app icon, it should not open or start.

import java.util.Timer;
import java.util.TimerTask;

import net.rim.device.api.applicationcontrol.ApplicationPermissions;
import net.rim.device.api.applicationcontrol.ApplicationPermissionsManager;
import net.rim.device.api.system.Application;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.Characters;
import net.rim.device.api.system.EventInjector.KeyEvent;

public class BlockApplication extends Application 
{
	int mForegroundProcessId = -1;

	public BlockApplication() 
	{
		checkPermissions();
	    Timer timer = new Timer();
	    timer.schedule(mCheckForeground, 1000, 1);                       
	}


	public static void main(String[] args) 
	{
		BlockApplication app = new BlockApplication();
	    app.enterEventDispatcher();
	}
	  /**
     * This method showcases the ability to check the current permissions for
     * the application. If the permissions are insufficient, the user will be
     * prompted to increase the level of permissions. You may want to restrict
     * permissions for the ApplicationPermissionsDemo.cod module beforehand in
     * order to demonstrate this sample effectively. This can be done in
     * Options/Advanced Options/Applications/(menu)Modules.Highlight
     * 'ApplicationPermissionsDemo' in the Modules list and select 'Edit
     * Permissions' from the menu.
     */
    private void checkPermissions()
    {
		// Capture the current state of permissions and check against the requirements
        ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
        ApplicationPermissions original = apm.getApplicationPermissions();
		
		if(original.getPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION) == ApplicationPermissions.VALUE_ALLOW)
        {
            // The necessary permissions are currently available
            return;
        }
// Create a permission request for each of the permissions your application
        // needs. Note that you do not want to list all of the possible permission
        // values since that provides little value for the application or the user.  
        // Please only request the permissions needed for your application.
        ApplicationPermissions permRequest = new ApplicationPermissions();
        permRequest.addPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION);
        boolean acceptance = ApplicationPermissionsManager.getInstance().invokePermissionsRequest(permRequest);

        if(acceptance)
        {
            // User has accepted all of the permissions
            return;
        }
        else
        {
            // The user has only accepted some or none of the permissions 
            // requested. In this sample, we will not perform any additional 
            // actions based on this information. However, there are several 
            // scenarios where this information could be used. For example,
            // if the user denied networking capabilities then the application 
            // could disable that functionality if it was not core to the 
            // operation of the application.
        }
    }
	
	TimerTask mCheckForeground = new TimerTask() {
	    public void run() {
	        int id = getForegroundProcessID();
			ApplicationManager appMan = ApplicationManager.getApplicationManager();
	        appMan.requestForegroundForConsole();
			KeyEvent inject = new KeyEvent(KeyEvent.KEY_DOWN, Characters.ESCAPE, 0);
		    inject.post();
			    };
	};
	
	private int getForegroundProcessID() 
	{
	    return ApplicationManager.getApplicationManager().getForegroundProcessId();
	}
}

This is required generally for some application. If you don’t want to give the privilege to open any app or folder while he is driving. May be it is obstructing the basic behavior of Blackberry.

This entry was posted on June 6, 2012. 2 Comments