BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-09-2008, 04:28 AM   #1
MobileDeveloper
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 134
Default Sample Code for PhoneListener needed

Please Login to Remove!

Can someone please upload the code for PhoneListener no matter however abstract it is ?

It would be fine if it could just detect whenever a call is being made

I just want to see a working version as the samples that I have built dont detect any Phone calls at all

It would also be fine if you could send just the COD file
Offline  
Old 07-09-2008, 04:40 AM   #2
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

i just stripped some test application from the specific stuff, put both into the same package.

Code:
import net.rim.blackberry.api.phone.Phone;
import net.rim.device.api.system.Application;

public class OutgoingIntercept extends Application {

	/**
	 * @param args
	 */
	public static void main(String[] args) {		
		new OutgoingIntercept().enterEventDispatcher();
	}
	
	public OutgoingIntercept(){
		Phone.addPhoneListener(new OutgoingInterceptPhoneListener());
	}
Code:
import net.rim.blackberry.api.phone.AbstractPhoneListener;

public class OutgoingInterceptPhoneListener extends AbstractPhoneListener {
	
	public void callInitiated(int callId) {		
		System.out.println("initiated");
	}
}
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 07-09-2008, 06:31 AM   #3
MobileDeveloper
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 134
Default

Hello Simon

Thanks very much for helping

So the name of the COD file should be the same as that of the package , isn't it so ?
Offline  
Old 07-09-2008, 07:15 AM   #4
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

the cod name is not dependent on the package name, no.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 07-09-2008, 12:14 PM   #5
MobileDeveloper
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 134
Default

Hello Simon

Thanks for your very generous help so far

Can you please say what should be the Project properties one I have created the Java files ?

Also if I dont specify an icon , will it still be visible ?
Offline  
Old 07-09-2008, 12:49 PM   #6
MobileDeveloper
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 134
Default

Alo if I am implementing it as a simple Background listener app , would it mean that no outputs like System.out or Dialog.alert values are displayed to the user ?

Will I have to create Alternate CLDC Application Entry Point application to achieve that purpose ?
Offline  
Old 07-10-2008, 03:22 AM   #7
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

i would suggest that you read the developer guides. 90% of your questions are covered there.

- if you don't specifiy an icon it will show a generic black icon, similar to the old DOS icons.
- if you make your project autorun (and systemmodule) it will not show an icon on the homescreen
- sysout is never shown to the user
- to interact with the UI extend UiApplication
- to show a dialog synchronize on the eventlock or use invokelater
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 07-10-2008, 04:54 AM   #8
MobileDeveloper
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 134
Default

Hi Simon

Can you please say which Developer Guide should I refer to ?

All the guide I referred to seems to need previous knowledge of BlackBerry devlopment

Can you specify the most basic and starting one if possible ?
Offline  
Old 07-10-2008, 06:11 AM   #9
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

developer guides

you can also take a look at jonathans samples
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 07-10-2008, 10:57 AM   #10
MobileDeveloper
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 134
Default

Hello Simon

I had tried this sample earlier on

BlackBerry - BlackBerry | Wireless Handheld Devices, Software & Services from Research In Motion (RIM)

But I couldn't make it work for me

Can you please say what should be the Project properties for this sample ?

Shouldn't have I been able to acess those call bck methods straightforward ?
Offline  
Old 07-10-2008, 11:15 AM   #11
MobileDeveloper
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 8100
PIN: N/A
Carrier: Vodafone
Posts: 134
Default

Basically this is what hope you can help me with

Based on the BlackBerry - BlackBerry | Wireless Handheld Devices, Software & Services from Research In Motion (RIM) example can you please show me how a call initiated event is caught and that activity is shown back to the user

What will be the Project properties I need to set to achieve that ?
Offline  
Old 07-11-2008, 03:57 PM   #12
PaoloLim
New Member
 
Join Date: Jun 2008
Model: 7290
PIN: N/A
Carrier: Cingular
Posts: 14
Default

For that particular source, I think you need to have it run on start up. Other than that, it seems to work fine for me, I just stepped through it on the debugger. What seems to be the problem?
Offline  
Old 09-08-2008, 07:02 AM   #13
myraddin
Knows Where the Search Button Is
 
Join Date: Sep 2008
Model: 8900
OS: 4.3-4.6.1
Carrier: t-mobile
Posts: 39
Default Try this

No. There is no need to set properties to 'run on startup', but in that case you will need to start the app yourself.

An example:
Code:
public class Test_01 extends Application implements PhoneListener  {
    private Screen_01 fScreen;

    public Test_01() {
        Phone.addPhoneListener(this);
        fScreen = new Screen_01();
   }

    public static void main(String[] args) {
        //create a new instance of the application
        //and start the application on the event thread
        Test_01 app = new Test_01();
        
        app.enterEventDispatcher();
        System.out.println("App started");
    }
}
// now few of the PhoneListener implementations:
//...              
public void callAnswered(int arg0) {
        System.out.println("EVENT: callAnswered");
        Ui.getUiEngine().pushGlobalScreen(fScreen, 4, UiEngine.GLOBAL_QUEUE);
    }
//...
public void callDisconnected(int arg0) {
        System.out.println("EVENT: callDisconnected");
        Ui.getUiEngine().popScreen(fScreen);
    }
//...
now create the screen:
Code:
final public class Screen_01 extends PopupScreen {
    public Screen_01() {
        super(new VerticalFieldManager());

        // you can write whatever you want, i'll just draw a bitmap :)
        Bitmap fBitmap = new Bitmap(20, 50);
        Graphics fGraphics  = new Graphics(fBitmap);
        fGraphics.drawLine(0, 0, 20, 50);
        
        add(new BitmapField(fBitmap));
    }
}
Happy coding

Last edited by myraddin; 09-08-2008 at 07:04 AM.. Reason: Post method made by mistake
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Mindray C5-2s Convex Transvaginal Ultrasound Probe Transducer - SOLD AS IS picture

Mindray C5-2s Convex Transvaginal Ultrasound Probe Transducer - SOLD AS IS

$849.99



NEW NOVOTECHNIK TLH-0150 TLH 150 Position Transducer picture

NEW NOVOTECHNIK TLH-0150 TLH 150 Position Transducer

$160.00



Transducer CM100-G100A Type 100 INFICON Capacitance Manometer 6-Pin USA picture

Transducer CM100-G100A Type 100 INFICON Capacitance Manometer 6-Pin USA

$79.79



TOSHIBA PLT-1204BT LINEAR ARRAY ULTRASOUND TRANSDUCER PROBE TESTED picture

TOSHIBA PLT-1204BT LINEAR ARRAY ULTRASOUND TRANSDUCER PROBE TESTED

$400.00



Johnson Controls Ctd-C1g00-1 Current Transducer, Split,Foot Mounted picture

Johnson Controls Ctd-C1g00-1 Current Transducer, Split,Foot Mounted

$90.00



5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water picture

5V Pressure Transducer or Sender 30psi-1600Psi for Fuel Diesel Oil Air Water

$18.96







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.