Results 1 to 11 of 11

Thread: droid text app

  1. #1
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default droid text app

    i am trying to create a texting application, but am not sure where to start. i was thinking the first thing is a connection (thought wi-fi may be the easiest), but thought that the droid may already be connected to a network of some sort. would i have to establish a connection first?

    thanks in advance.

  2. #2
    Shoss's Avatar
    Shoss is offline Member
    Join Date
    Feb 2011
    Posts
    94
    Rep Power
    0

    Default Re: droid text app

    You shouldn't have to worry about the connection, the OS should take care of that for you. I think what you'll want to look at is the SmsManager class. It has a few different methods to send texts.

  3. #3
    Grkn is offline Member
    Join Date
    Oct 2011
    Posts
    65
    Rep Power
    0

    Default Re: droid text app

    public class Sms extends Activity; //Just class name

    String message="HI"
    String phoneNumber="destination number"
    SmsManager manager=SmsManager.getDefault();
    Intent intent=new Intent(Sms.this, Sms.class);
    PendingIntent pi=PendingIntent.getActivity(Sms.this,0 ,intent, 0);
    manager.sendTextMessage(phoneNumber, null, message, pi, null);

    This codes directly works but you have to determine 2 things
    Do you want to send SMS with text mode or PDU mode?

  4. #4
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: droid text app

    what's the difference b/w text mode and pdu mode?

  5. #5
    Grkn is offline Member
    Join Date
    Oct 2011
    Posts
    65
    Rep Power
    0

    Default Re: droid text app

    SMS Tutorial: Operating Mode: SMS Text Mode and SMS PDU Mode of SMS Text Mode and SMS PDU Mode|outline

    Link explains two types

  6. #6
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: droid text app

    i will go with the simplest, or easiest to use. would that be text mode?

  7. #7
    Grkn is offline Member
    Join Date
    Oct 2011
    Posts
    65
    Rep Power
    0

    Default Re: droid text app

    Text mode is easiest.

  8. #8
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: droid text app

    the code you sent me above made it look too easy. is this really all i need??

  9. #9
    Grkn is offline Member
    Join Date
    Oct 2011
    Posts
    65
    Rep Power
    0

    Default Re: droid text app

    that's all you can send exactly like that. I can send SMS with this code to other phone.

    But destination phone has to support text mode :)

  10. #10
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: droid text app

    So how do you know if the phone supports text mode?

  11. #11
    droidus is offline Senior Member
    Join Date
    Feb 2011
    Posts
    244
    Rep Power
    4

    Default Re: droid text app

    i am also getting an error on this line: manager.sendTextMessage(phoneNumber, null, message, pi, null);
    error: "Syntax error on tokens, ConstructorHeaderName expected instead"

    here is my code so far:
    Java Code:
    package com.text;
    
    import android.app.Activity;
    import android.app.PendingIntent;
    import android.content.Intent;
    import android.telephony.SmsManager;
    
    public class SMS extends Activity 
    {
    	String message="HI";
    			String phoneNumber="1112223333";
    			SmsManager manager=SmsManager.getDefault();
    			Intent intent=new Intent(SMS.this, SMS.class);
    			PendingIntent pi=PendingIntent.getActivity(SMS.this,0 ,intent, 0);
    			manager.sendTextMessage(phoneNumber, null, message, pi, null); 
    }

Similar Threads

  1. Replies: 8
    Last Post: 07-17-2011, 03:38 PM
  2. Replies: 7
    Last Post: 03-05-2011, 10:25 AM
  3. Replies: 0
    Last Post: 12-09-2010, 06:56 PM
  4. Replies: 0
    Last Post: 09-28-2010, 10:52 AM
  5. Replies: 0
    Last Post: 05-26-2008, 05:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •