Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
jlukin
Posts: 2
Registered: ‎08-14-2008
My Device: Not Specified
Accepted Solution

promptForResetIfRequired vs. requestPowerOff

[ Edited ]

Hi,

 

When trying to self delete our application by using following code,the application is not removed if we do Device.requestPowerOff(false) but the application is removed if we do CodeModuleManager.promptForResetIfRequired(). So PowerOff != Reset?

 

So my question is, is there a way to do a programtic reset that will remove our application? Or am I doing something wrong to do a self delete in our application?

 

This is happening on 

8800

v4.2.1.7.4

Platform 2.3.0.5.4

 

Thanks for your time.

Jay

 


 

ApplicationDescriptor ad = ApplicationDescriptor.currentApplicationDescriptor();
int moduleHandle = ad.getModuleHandle();
int rc = CodeModuleManager.deleteModuleEx(moduleHandle, true);

switch (rc)
{
case CodeModuleManager.CMM_OK_MODULE_MARKED_FOR_DELETION:
CodeModuleManager.promptForResetIfRequired();
//Device.requestPowerOff( false );
break;
case CodeModuleManager.CMM_OK:
//do something
break;
case CodeModuleManager.CMM_MODULE_IN_USE:
case CodeModuleManager.CMM_MODULE_IN_USE_BY_PERSISTENT_STORE:
//do something
break;
case CodeModuleManager.CMM_HANDLE_INVALID:
//do something
break;
case CodeModuleManager.CMM_MODULE_REQUIRED:
//do something
break;
default:
//do something
break;
}

 


 

Message Edited by jlukin on 08-22-2008 12:21 PM
Please use plain text.
Administrator
MSohm
Posts: 14,268
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: promptForResetIfRequired vs. requestPowerOff

You are correct, power off is not the same as reset.  Power off suspends running applications and puts the BlackBerry in a "sleep" mode.  When it is powered on applications resume from where they left off.  This is the same as powering on/off a BlackBerry using the power button or red end key (varies based on model).  The BlackBerry can power on almost instantly from this state.

 

A reset more closely resembles removing and reinserting the battery.  This stops all applications and the JVM.  When the BlackBerry restarts, the JVM restarts along with any auto-start applications.  This process takes a few minutes.

 

If promptForResetIfRequired yields true, then it means the BlackBerry is unable cod files until the BlackBerry is restarted.  The link below lists reasons why this may occur.

 

What Is - The reason a reset is required when upgrading an application
Article Number: DB-00602

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/What_Is...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.