Blackberry: Kill an application - blackberry

I want to kill an running application in blackberry, just like as task manager. Is there is any way to do that or any API available?
Thanks in advance.

call this method to kill a UiApplication....
public void killApp() {
System.exit(0);
}

As per other forums, below are the information I found. Try this if it helps you
First Way: you might have to just do a hard boot. take the battery out if all fails.
Second Way:
Stop a job that is running
1. In the BlackBerry® Administration Service, on the Devices menu, expand Deployment jobs.
2. Click Manage deployment jobs.
3. Search for the job that you want to stop.
4. In the search results, click the ID of the job that you want to stop. You can only stop jobs with a Running status.
5. Click Stop Current Execution.
6. Click Yes - Stop Current Execution.
Stopping a job that is running

Related

Difference in manual execution of running app in background and runAppInBackground() using appium

While executing runAppInBackground() for Android application through Appium the app gets restarted but when executed the same manually couldn't be able to reproduce the same. I Would like to deep dive into implementation of a runAppInBackground() method to reproduce the same issue in a manual way.
You need to look behind the code of runAppInBackground
From java client side (your test code) perspective, it is a single call to Appium server:
POST "/session/:sessionId/appium/app/background"
If you continue looking into where its implemented on server side, you finish with appium-android-driver function.
In short what it does:
Get current activity and package
Press physical Home button
Wait for time you provided as argument (seconds)
Bring up back in focus based on different conditions; from the code you can understand what activity is being started
Basically its a sequence of adb shell commands, that you can run from terminal.
My guess is that step 4 you did manually may differ from what Appium is doing: different activities/arguments for activity been called

How to attach Cycrypt or gdb before a program start

I am in the middle of PT where application is checking for JailBreak, sooner it starts and the first screen user see is Alert that application is Jailbroken and click okay to exit.
My question: Is there a way to attach Cycript before application starts or start application with Cycript as it seems very late to change method when it is already called by application and I am on the close alert.
Please advise.
or advise If I can run application with GDB, rather than attaching with the process later -- same issue here, it is too late to attach to gdp after running the application because decision of JailBroken is already done.
I found this link which explains in detail about run time modifications using gdb as well as with cycript.
May be helpful for you or someone else.
I just encountered same question and I got over that by using choose() in cycript and function -[UIModalView dismissWithClickedButtonIndex:animated:]
Use choose(UIAlertView) to search all AlertView
Try figure out which one is your target and call [choose(UIAlertView)[i] dismissWithClickedButtonIndex:0 animated:0]
*i is the sequence you get in step 1

Forcing a Windows service to fail

Whenever a specific Windows service fails I want to run a program I've created myself. However, I simply can't find a way to make it fail on purpose, so that I can actually test that everything works correctly.
Note that the service in question is not something I've written myself, so I can't make it fail programmatically from inside the code. I wouldn't, however, mind writing a program that can make a service fail.
Of course I would prefer just having a "Make service fail" button somewhere in services.msc ... ;)
The server I'm doing this on is running Windows Server 2012.
If you don't want to use command line :
As an admin open the Windows Task Manager, in the Services tab find the service you want to test. Right click the service and click on Go to process. The selected process (if any) is the one corresponding to your service. Kill this process to simulate a service failure.
Be aware that killing a process this way can lead to problems.
Define "fail". If you want the process to end, just use pskill or a similar tool that can terminate a process elevated (as an admin).

Unpause a rails server that was paused in a different terminal window

I'm on mac osx using zsh. If I start a rails server with "rails s" I can put it in the background by hitting "ctrl-z" in my terminal (zsh).
If I open up a different terminal window then I don't see the rails server if I do "jobs". However, I can see it when I do "ps".
Is there a way I can somehow "unpause" the rails server in this new terminal window?
You can not easily move a process to a new tty. The easiest solution would be to start it in a screen session, detach screen and then resume in the new terminal.
The job is "stopped" by sending it a SIGSTOP.Your C-z doesn't send the job into the background. It "stops" it. You can then move it into the background using the bg shell builtin. However, if you send this process a SIGCONT (kill -CONT <pid>), it should bring the process back to the foreground. This can be done from a different shell.
You will not see it if you type jobs because it is a job controlled by a different shell (the other terminal window and not the one where you typed jobs). Processes however are "global" and can be seen from anywhere using the ps command (as you rightly pointed out).
Update: Looks like I spoke too soon. Apparently, the signal alone isn't enough to bring it back to the foreground. Probably something to do with the shell.

Nant: Process id of a service that is already running

Does anyone know how to get the PID of the process that a windows service is running in from Nant?
I am having file locking problems. I issue a stop command to the service and then try and delete the Windows service's files. However these are quite often locked by the process that the Windows service is running in. I want to find the PID so that I can wait for it to terminate before deleting.
Thanks
You might have to create a custom nant task to do this. However you might want to see about just adding maybe a delay like 1 min or something before you try to replace your files. Might be easier.

Resources