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
Developer
dynamicdhaka
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
Please use plain text.
Developer
peter_strange
Posts: 19,598
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?

Please use plain text.
Developer
dynamicdhaka
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
Please use plain text.
Developer
dynamicdhaka
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
Please use plain text.
Developer
dynamicdhaka
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
Please use plain text.
Developer
dynamicdhaka
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
Please use plain text.