473,507 Members | 4,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why my phone gets "You have no message" when I am sending another message string ?

108 New Member
I am trying to send a message from 1 phone to another and came up with the following codes ..


Expand|Select|Wrap|Line Numbers
  1. Main class::
  2.  
  3. public void commandAction(Command command, Displayable displayable)
  4. {        
  5.         if (displayable == form1) {
  6.  
  7.             if (command == cancelCommand) {               
  8.  
  9.  exitMIDlet();
  10.  
  11.             } else if (command == okCommand) { 
  12.  
  13.                         // write pre-action user code here
  14. //GEN-LINE:|7-commandAction|4|25-postAction
  15.                // m=new message(textField1,textField2,stringItem);
  16.                 Thread th=new Thread(this);
  17.                th.start();
  18.  
  19.  
  20.  
  21.             }
  22.         }
  23.     }
  24.  
  25.  
  26. public void run() {
  27.          try {
  28.  
  29.                         // write pre-action user code here
  30.  
  31.                 m=new message(textField1,textField2,stringItem);
  32.                 MessageConnection cn= getcnnc("sms://+230"+textField1.getString()+":5000");
  33.                 m.message( cn, textField2.getString(), "sms://+230"+textField1.getString()+":5000");
  34.  
  35.  
  36.                   // m.send();
  37.                 // write post-action user code here
  38.                     }
  39.                 catch(Exception e){
  40.  
  41.                 }
  42.     }
  43.  
  44.  
  45.  
  46.  
  47. Message class:
  48. public class message implements Runnable{
  49.     TextField tx2;
  50.     TextMessage tmsg;
  51.     StringItem status;
  52.     message(TextField textField,TextField textField2,StringItem text) {
  53.         tx1=textField;;
  54.         tx2=textField2;
  55.         status=text;
  56.     }
  57.  
  58.  
  59.     TextField tx1;
  60.  MessageConnection mc;
  61.     public void run() {
  62.         try{
  63.  
  64.              MessageConnection cn=getcnnc("sms://+2307479110:5000");
  65.         message(cn,tx2.getString(),"sms://+2307139151:5000");
  66.  
  67.        // cn.send(tmsg);
  68.      //   mc.setMessageListener(this);
  69.        status.setLabel("Delivered");
  70.         }
  71.         catch(Exception e){
  72.              status.setLabel(e.getMessage());
  73.  
  74.              e.printStackTrace();
  75.         }
  76.     }
  77.  
  78.  
  79.     public MessageConnection getcnnc(String url) throws IOException{
  80.         return (MessageConnection)Connector.open(url);
  81.     }
  82.  
  83.     public void message(MessageConnection mc,String aaadr,String url) throws IOException{
  84.         TextMessage tmsg=(TextMessage)mc.newMessage(MessageConnection.TEXT_MESSAGE);
  85.         tmsg.setAddress(url);
  86.         tmsg.setPayloadText(aaadr);
  87.         mc.send(tmsg);
  88.         //mc.setMessageListener(this);
  89.  
  90.     }
  91.  
  92.  
  93.  
  94.     public void send(){
  95.         try{
  96.  
  97.              MessageConnection cn=getcnnc("sms://+230"+tx1.getString()+":5000");
  98.  
  99.         message(cn,tx2.getString(),"sms://+230"+tx1.getString()+":5000");
  100.  
  101.         mc.send(tmsg);
  102.      //   mc.setMessageListener(this);
  103.        status.setLabel("Delivered");
  104.         }
  105.         catch(Exception e){
  106.              status.setLabel("Failed");
  107.         }
  108.     }
  109. }

I deployed it in a phone and send a message to another. The other phone was using the default message program and it received a message “You have no message”. How do I sort this problem out?
Dec 21 '10 #1
0 1165

Sign in to post your reply or Sign up for a free account.

Similar topics

16
15716
by: Dave Smithz | last post by:
Hi, In summary: I want to a form to submit information via a HTTP POST, however, when using Internet Explorer I want to be able to use the back button and all the information retained....
2
5234
by: Jeff Magouirk | last post by:
Dear All, I have written an update trigger that should write a message to an audit table When I try to update any field in the table I recieve the following error message - Stirng or...
22
3292
by: Dr Duck | last post by:
GDay all, Something seems odd to me.... I wrote a simple C# function public void bind(ref object a, ref object b, bool atob) { if(atob) b = a; else
4
8189
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
4
3959
by: Liz Patton | last post by:
Here's the exception: System.Exception: Unable to send mail: Could not access 'CDO.Message' object. ---> System.Web.HttpException: Could not access 'CDO.Message' object. --->...
3
1389
by: blueapricot416 | last post by:
I have some javascript in a standard HTML page that uses the ubiquitous "XMLHttpRequest" to send data to a remote ASP page. If that page "answers back" by sending a string using a simple...
18
11825
by: Martin Jørgensen | last post by:
Hi, Today I got a really strange problem... I've made myself a data-file and I read in data from that file.... When I read something like this line: 03 04 05, 00 04 01, 05 03 07, 08 03...
3
5398
by: Frank | last post by:
I am attempting to develop a solution where I handle bounced e-mails. I wish to field all bounced emails in a custom email account such a bounced@mycompany.com From the aricle at...
3
2112
crystal2005
by: crystal2005 | last post by:
I found such eror message when i tried to test sending email. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in...
1
165
by: Alexnb | last post by:
Basically I want the code to be able to pick out how many strings there are and then do something with each, or the number. When I say string I mean how many "strings" are in the string "string...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.