How to disconnect an incoming call

I’m trying to disconnect an incoming call and block the BlackBerry device ringing. I tried Alert.setVolume (0) and some EventInjector keys, but that didn't work.

So how to disconnect an incoming call?

+7
source share
4 answers

I was puzzled by your question and decided to do it. I have tried various things including

  • Play a sound file of "silence", hoping to block the device, calling or occupying a media player.
  • Hacking the phone screen via UiApplication.getUiApplication().getActiveScreen()
  • Keyboard event injection

In the end, when you press the VOLUME UP button (VOLUME DOWN key), an event is triggered, and the device mutes the ringtone on an incoming call. The disadvantage of this approach is that sometimes the device performed the ring for a second before muffling.

 import net.rim.blackberry.api.phone.AbstractPhoneListener; import net.rim.blackberry.api.phone.Phone; import net.rim.device.api.system.Application; import net.rim.device.api.system.EventInjector; import net.rim.device.api.ui.Keypad; class Muter extends AbstractPhoneListener { public void callIncoming(int callId) { Thread muterThread = new Thread(new Runnable() { public void run() { EventInjector.invokeEvent(new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEvent.KEY_DOWN, (char) Keypad.KEY_VOLUME_UP, 0)); EventInjector.invokeEvent(new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEvent.KEY_UP, (char) Keypad.KEY_VOLUME_UP, 0)); } }); muterThread.setPriority(Thread.MAX_PRIORITY); muterThread.start(); } } public class MuterApp extends Application { public static void main(String[] args){ Phone.addPhoneListener(new Muter()); new MyApp().enterEventDispatcher(); } } 

The following also works (replace the Muter stream in callIncoming() with the following code method).

  UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { EventInjector.invokeEvent(new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEvent.KEY_DOWN, (char) Keypad.KEY_VOLUME_UP, 0)); EventInjector.invokeEvent(new EventInjector.KeyCodeEvent(EventInjector.KeyCodeEvent.KEY_UP, (char) Keypad.KEY_VOLUME_UP, 0)); } }); 
+6
source

You wo n’t be able to mute the sound programmatically (found a couple of other sources that said the same thing). The best workarounds that seemed to come up with was to use EventInjector to change the phone’s sound profile to quiet.

+3
source

Some Blackberry phones have a dumb key. You can try the following idea:

 public void callIncoming(int callId) { if (KeyPad.hasMuteKey()) { /* Inject KEY_SPEAKERPHONE event */ } else { /* Inject KEY_VOLUME_DOWN event N times, so that you get the mute effect */ } } 
+2
source

I'm completely new to all this ... but I thought I could also add a price to my 2 cents ...

I tried to find ways to programmatically change profile settings ...

I found that although we cannot (yet) change the profile settings, we can change the setting that we use (change the profile you use, I think) - this is what I found in the search for information, although I have to give credit to alishaik786 for the code.

  public final class LoadingScreen extends MainScreen implements FieldChangeListener { public LoadingScreen() { createGUI(); } private void createGUI() { try { ApplicationManager.getApplicationManager().launch("net_rim_bb_profiles_app"); } catch (Exception e) { //Exception } } public void fieldChanged(Field field, int context) { } } 
0
source

All Articles