BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 05-10-2010, 11:55 PM   #1
zulfiqarchandio
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 9700
PIN: N/A
Carrier: Engineer
Posts: 22
Default Auto sms

Please Login to Remove!

Hi brothers, i wan tot create an application, my requirement is when i open the application there are to radiofields for availability and not availability , if i select availability a textfield apears to take an message, after after that any one calls the message set by be is sent to that caller that i am in meeting etc . how would i do it??


Regards:
Zulfiqar
Offline  
Old 05-11-2010, 12:36 AM   #2
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

I dont know it will work or not but what i understand your problem.

if you are not available.


Code:
public class PhoneCallInterceptor extends AbstractPhoneListener {

public void callIncoming(final int callId) {

		final PhoneCall call = Phone.getCall(callId);
		final String number = call.getPhoneNumber();
//now you get the callers number just send sms to this number

}

and you have to and call through your code.
Code:
EventInjector.KeyCodeEvent pressEndKey=new EventInjector.KeyCodeEvent(KeyCodeEvent.KEY_DOWN,( char)Keypad.KEY_END,0,100);
EventInjector.KeyCodeEvent releaseEndKey=new EventInjector.KeyCodeEvent(KeyCodeEvent.KEY_UP,(ch ar)Keypad.KEY_END,0,100);
Thread.sleep(1000); 
EventInjector.invokeEvent(pressEndKey);
EventInjector.invokeEvent(releaseEndKey);
__________________
blog.vimviv.com

Last edited by vivartpandey; 05-11-2010 at 12:37 AM..
Offline  
Old 05-11-2010, 03:09 AM   #3
zulfiqarchandio
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 9700
PIN: N/A
Carrier: Engineer
Posts: 22
Default

Thanks vivartpandey
I am able to disconnect the incoming call at not available state through my code but how to send the caller message automatically.

Zulfiqar
Offline  
Old 05-11-2010, 03:33 AM   #4
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

Code:
public class PhoneCallInterceptor extends AbstractPhoneListener {

public void callIncoming(final int callId) {

		final PhoneCall call = Phone.getCall(callId);
		final String number = call.getPhoneNumber();
                       String msg = ("I am not available");
                SendSMS sendSMS = new SendSMS(number , msg);
	        sendSMS.start();

}
Code:
import java.io.IOException;

import javax.microedition.io.Connector;
import javax.wireless.messaging.Message;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;

import net.rim.device.api.system.Application;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.Screen;
import net.rim.device.api.ui.Ui;
import net.rim.device.api.ui.UiEngine;
import net.rim.device.api.ui.component.Dialog;

public class SendSMS extends Thread {

	private String to;
	private String msg;

	public SendSMS(String to, String msg) {
		this.to = to;
		this.msg = msg;

	}

	public void run() {
		
		MessageConnection mc = null;
		TextMessage m = null;
		// mc = RecSMS.messconn;
		try {
			
				mc = (MessageConnection) Connector.open("sms://" + to);
			

		} catch (IOException e1) {
			e1.printStackTrace();
		}
		m = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE);
		m.setPayloadText(msg);
		try {
			mc.send(m);
			

		} catch (Exception e) {
			
		} finally {
			try {
				mc.close();
			} catch (IOException e) {
				// statusString = "Exception: close()"+e.getMessage();
				
			}
		}
	}

}
__________________
blog.vimviv.com
Offline  
Old 05-11-2010, 06:27 AM   #5
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

Quote:
Originally Posted by zulfiqarchandio View Post
Thanks vivartpandey
I am able to disconnect the incoming call at not available state through my code but how to send the caller message automatically.

Zulfiqar
have you tested on real device??
i have a doubt that this will not work on real device.
__________________
blog.vimviv.com
Offline  
Old 05-11-2010, 06:44 AM   #6
zulfiqarchandio
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 9700
PIN: N/A
Carrier: Engineer
Posts: 22
Default

Thank you very much vivartpandey. it works.
Offline  
Old 05-11-2010, 06:46 AM   #7
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

Quote:
Originally Posted by zulfiqarchandio View Post
Thank you very much vivartpandey. it works.
have you tested on real device that call disconnect code??
__________________
blog.vimviv.com
Offline  
Old 05-11-2010, 07:17 AM   #8
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

Don't forget to set permissions on real device: Options => Advanced Options => Applications => [Your Application] =>Edit Default permissions =>Interactions =>key stroke Injection
__________________
blog.vimviv.com
Offline  
Old 05-13-2010, 07:06 AM   #9
zulfiqarchandio
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 9700
PIN: N/A
Carrier: Engineer
Posts: 22
Default

No i have not tested on real device. because of signing, after getting rights i will check then i wil tell you.

thanks
zulfiqar
Offline  
Closed Thread



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


Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc picture

Original New DEC Digital DCJ11-AE 57-19400-09 Vintage CPU x 1pc

$100.00



Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec... picture

Vintage Journal Beautiful Garden Flower Embossed Leather-Antique Handmade Dec...

$29.04



Vintage Printing Letterpress Printers Block Months Of The Year Jan-Dec picture

Vintage Printing Letterpress Printers Block Months Of The Year Jan-Dec

$19.00



DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101  picture

DEC / AMI 304E 21-15542-01 vintage ceramic IC - KTF11 Chip *NEW* 40278101

$50.00



Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16) picture

Dec/Adac Corp. D4-10390 Rev 6 Model 1664ATTL Output Pulse Board 1983 (B16)

$189.99



VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250 picture

VINTAGE Bruker Board DEC W4P3042 for SpectroSpin 250

$50.00







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