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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

about call hangup in 8700g --os version:4.2.1.93 and platform:2.3.0.77

hi ..i am trying to make call hangup functionality in my device.but it is not working .i have used EventInjector.keyCodeEvent to make the hangup  in PhoneListener. i am attaching the source code..

 

package callHangUp;



import java.util.Timer;
import java.util.TimerTask;
import net.rim.blackberry.api.invoke.Invoke;
import net.rim.blackberry.api.invoke.PhoneArguments;
import net.rim.blackberry.api.phone.AbstractPhoneListener;
import net.rim.blackberry.api.phone.Phone;
import net.rim.blackberry.api.phone.PhoneCall;
import net.rim.device.api.applicationcontrol.ApplicationPermissions;
import net.rim.device.api.applicationcontrol.ApplicationPermissionsManager;
import net.rim.device.api.system.ControlledAccessException;
import net.rim.device.api.system.EventInjector;
import net.rim.device.api.system.KeyListener;
import net.rim.device.api.system.KeypadListener;
import net.rim.device.api.system.EventInjector.KeyCodeEvent;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.component.Dialog;


public  class CustomPhoneListenere extends AbstractPhoneListener implements KeyListener
 {
    
     private ApplicationPermissions permissions;
    
    
    
    public CustomPhoneListenere()
        {
        permissions= ApplicationPermissionsManager.getInstance().getApplicationPermissions();
        
        }
    

    private void doCallMonitoringOutgoing(int callId)
        {
        if (permissions.getPermission(ApplicationPermissions.PERMISSION_PHONE) == ApplicationPermissions.VALUE_ALLOW)
        {
         if(Phone.getActiveCall().getStatus() == PhoneCall.STATUS_CONNECTING)
           {
            injectEndCall();
           }
        }
        }
    private void doCallMonitoringIncoming(int callId)
     {
    
      injectEndCall();
             
    }
    public void callInitiated(int callId)
        {
          doCallMonitoringOutgoing(callId);
        }
    
    public void callIncoming(int callId)
     {
      doCallMonitoringIncoming(callId);
     }
    private void injectEndCall()
        {
        
         try
            {
            if(permissions.getPermission(ApplicationPermissions.PERMISSION_EVENT_INJECTOR) == ApplicationPermissions.VALUE_ALLOW)
                {
                EventInjector.KeyCodeEvent pressEndKey = new EventInjector.KeyCodeEvent
                 (
                  EventInjector.KeyCodeEvent.KEY_DOWN,(char) Keypad.KEY_END, KeypadListener.STATUS_NOT_FROM_KEYPAD, 10
                 );
                EventInjector.KeyCodeEvent releaseEndKey = new EventInjector.KeyCodeEvent
                  (
                   EventInjector.KeyCodeEvent.KEY_UP,(char) Keypad.KEY_END, KeypadListener.STATUS_NOT_FROM_KEYPAD, 10
                  );
                EventInjector.invokeEvent(pressEndKey);
                EventInjector.invokeEvent(releaseEndKey);
             }
            }
         catch(ControlledAccessException cae)
             {
            
             }
        }
    
     
     public void callEndedByUser(int callId)
        {
         callDisconnected(callId);
        }
     public void callFailed(int callId, int reason)
        {
         callDisconnected(callId);
        }
     public boolean keyChar(char key, int status, int time)
        {
         System.out.println(key);
        
         return false;
        }
    public boolean keyDown(int keycode, int time)
        {
         // TODO Auto-generated method stub
        return false;
        }
    public boolean keyRepeat(int keycode, int time)
        {
        // TODO Auto-generated method stub
        return false;
        }
    public boolean keyStatus(int keycode, int time)
        {
        // TODO Auto-generated method stub
        return false;
        }
    public boolean keyUp(int keycode, int time)
        {
        // TODO Auto-generated method stub
        return false;
        }    
  }

 

but it is not working.... i am again listing my os version: 4.2.1.93 and platform 2.3.0.77  .................This series of device does not support   EventInjector.KeyCodeEvent()??  please help me ........

Mobile Application Advisor
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: about call hangup in 8700g --os version:4.2.1.93 and platform:2.3.0.77

Can you just confirm that you are developing using 4.2.1?

Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: about call hangup in 8700g --os version:4.2.1.93 and platform:2.3.0.77

no i am using jde 4.5

Mobile Application Advisor
Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: about call hangup in 8700g --os version:4.2.1.93 and platform:2.3.0.77

[ Edited ]

no i am using jde 4.5.should i use 4.2.1?  ok i am trying by using 4.2.1

Mobile Application Advisor
Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: about call hangup in 8700g --os version:4.2.1.93 and platform:2.3.0.77

hi peter.. i have changed my development jde 4.5 to 4.2.1 and i have used 8700g simulator.it works fine in simulator.but it does not work in device...please help me..thanks again
Mobile Application Advisor
Highlighted
Developer
Posts: 101
Registered: ‎12-10-2009
My Device: styile 9670
My Carrier: SingTel

Re: about call hangup in 8700g --os version:4.2.1.93 and platform:2.3.0.77

do not have anyone???

Mobile Application Advisor