473,659 Members | 2,667 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 1173

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

Similar topics

16
15735
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. Presently we get a "Page has expired" message. How can we avoid this? Full details: Having searched for postings on how to avoid the "Page has Expired" they are
2
5252
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 Binary data would be trunicated The statement has been termined.
22
3328
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
8197
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 TcpClient, NetworkStream and StreamWriter classes. but with low level socket it doesn't work (When using the Socket class Send method).
4
3966
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. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): Unspecified error --- End of inner exception stack trace ---
3
1394
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 Response.Write, which I then use in the original HTML page to dynamically update stuff, is this "AJAX"? Specifically, is there anything "wrong" with sending back info from classic ASP pages using simple Response.Writes? (Is there usually something...
18
11840
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 00, 09 06 03 ... etc. with something like scanf("%i %i %i, ", &var1, &var2, &var3);
3
5406
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 http://www.systemwebmail.com/faq/2.7.aspx, I gather I could use: mail.Headers.Add( "Reply-To", "alternate_email@mycompany.com" ); When I test this from a test web app, I don't seem to field a bounced email
3
2129
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 /www/110mb.com/h/e/a/v/e/n/t/u/heaventure/htdocs/send_contact.php on line 10 Do we have to set something on the hosting server in order to be able to send message?? This is my code that i encountered the problem
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 string string non-string string" Does that help? Fredrik Lundh wrote: --
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8339
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8535
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7360
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4176
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.