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
Posts: 445
Registered: ‎10-14-2008
My Device: Blackberry Bold 9000
My Carrier: SingTel

Background Process

How i can create an application which runs everytime in the background and whenever i receive a call then it will vibrate.

for viberatio i used

 

net.rim.device.api.system.Alert.startVibrate(5);

 

is it ok ?

 

1. what i have to do to run a background process. i extended Application and implement PhoneListener. i need code for threading.

 

2. want to run this application on startup.

 

reply soon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks & Regards
Zahid Naqvi | Senior Software Engineer
Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Background Process

1. Your approach is correct, Write background Application by extending "Application". Tell more about wat exactly you want about thread in this context.

2. Set your application project properties for auto startup.

 

Tnx.


Use Search. "Accept Solution" If the problem is resolved.
Highlighted
Developer
Posts: 445
Registered: ‎10-14-2008
My Device: Blackberry Bold 9000
My Carrier: SingTel

Re: Background Process

my main aim is to create an application which is responsible to play a song on bluetooth attach.

 

i solved that how we play a song on listener.

 

now for testing purpose my issue is to run a process in background forever which would be play a song on every call answered.

 

for this approch i extended Application implement PhoneListener 

 

Code :

 

import net.rim.blackberry.api.phone.PhoneListener;
import net.rim.device.api.system.Application;
import net.rim.device.api.ui.component.Dialog;


public class keylistener extends Application implements Runnable,PhoneListener{

    public keylistener() {
    }   
   
    public static void main(String[] args) {
        new keylistener().requestBackground();
    }

    public void run() {
        Dialog.alert("Run");
    }

    public void callAdded(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callAnswered(int arg0) {
        Dialog.alert("callAnswered");
       
    }

    public void callConferenceCallEstablished(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callConnected(int arg0) {
        // TODO Auto-generated method stub
        net.rim.device.api.system.Alert.startVibrate(50);//
       
    }

    public void callDirectConnectConnected(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callDirectConnectDisconnected(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callDisconnected(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callEndedByUser(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callFailed(int arg0, int arg1) {
        // TODO Auto-generated method stub
       
    }

    public void callHeld(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callIncoming(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callInitiated(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callRemoved(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callResumed(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void callWaiting(int arg0) {
        // TODO Auto-generated method stub
       
    }

    public void conferenceCallDisconnected(int arg0) {
        // TODO Auto-generated method stub
       
    }

}
 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks & Regards
Zahid Naqvi | Senior Software Engineer