Recognize/React on incoming SMS

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Postby plusminus » Sun Feb 17, 2008 3:31 pm

Hello puyopuy,

Just saw the reason:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. WARN/ActivityManager(508): Permission Denial: receiving Intent { action=android.provider.Telephony.SMS_RECEIVED extras=Bundle[{pdus=[Ljava.lang.Object;@4027da00}] } from org.anddev.android.smstretcher requires android.permission.RECEIVE_SMS
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


:arrow: what means we forgot to update the permissions:
instead of:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.     <uses-permission id="android.permission.RECEIVE_SMS" />
Parsed in 0.000 seconds, using GeSHi 1.0.8.4

use:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.     <uses-permission android:name="android.permission.RECEIVE_SMS" />
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Can you show how you would pass a notification to top bar

Postby robisen » Thu Feb 21, 2008 10:59 pm

Can you show how you would then send a notification, instead of a toast, to the status bar?

Thanks
robisen
Junior Developer
Junior Developer
 
Posts: 14
Joined: Thu Feb 21, 2008 10:57 pm

Postby plusminus » Tue Feb 26, 2008 8:00 pm

Hello robisen,

did the Tutorial some days ago after you posted :arrow: http://www.anddev.org/viewtopic.php?t=1019
Forgot to post her ;)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

reply

Postby robisen » Tue Feb 26, 2008 8:24 pm

Great but I had figured it out. One of my issues was trying to use a deprecated constructor. BTW do you find the drop down for the default SMS inbox view annoying? I sure do.
robisen
Junior Developer
Junior Developer
 
Posts: 14
Joined: Thu Feb 21, 2008 10:57 pm

Postby plusminus » Wed Feb 27, 2008 10:07 am

Hello robisen,

its also for all the notifications and missed calls, etc...

The good thing is that it is accessible from everywhere. You can pull it down above any other Activity.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby inter » Wed Mar 05, 2008 10:46 am

Hi ,plusminus

How to send a SMS message to Android on localhost ? To test program above ?

Thank you
inter
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 21, 2008 10:13 am

Top

Postby plusminus » Wed Mar 05, 2008 11:37 am

Hello inter,

use the search function.
It returns results like: [TinyTut] - Simulating incoming Phone Calls / SMS in ECLIPSE

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby inter » Sat Mar 08, 2008 4:57 pm

Hello ,plusminus .Thank you for reply


I want to build an chat application on Android .Do you know where I can view tutorial about it

Thanks
inter
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 21, 2008 10:13 am

Postby plusminus » Sat Mar 08, 2008 5:44 pm

I haven't done a chat-app. :)

If you experience problems during your development process, let us know.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

can i get code for sending a sms

Postby abhilash » Wed Mar 12, 2008 6:33 am

hi
can any one post a code for sending sms
abhilash
Developer
Developer
 
Posts: 26
Joined: Fri Feb 22, 2008 11:21 am
Location: HYDERABAD

SMSReceiver prob?

Postby dkkundudolan » Wed Mar 19, 2008 2:38 pm

Hi,
I had tried SMSReceiver. but its not working. its shoing message that java.lang.classNoFoundException.
hw 2 do this.?
please reply me fast.

Thanks,
Dolan.
i had gone through the following:

package com.smsreceiver.android;
import android.content.Context;
import android.content.Intent;
import android.content.IntentReceiver;
import android.os.Bundle;
import android.provider.Telephony;
import android.telephony.gsm.SmsMessage;
import android.util.Log;
import android.widget.Toast;

public class SMSReceiver extends IntentReceiver {

private static final String LOG_TAG = "SMSReceiver";

private static final String ACTION = "android.provider.Telephony.SMS_RECEIVED";

public void onReceiveIntent(Context context, Intent intent) {
if (intent.getAction().equals(ACTION)) {

StringBuilder sb = new StringBuilder();


Bundle bundle = intent.getExtras();
if (bundle != null) {

SmsMessage[] messages =
Telephony.Sms.Intents.getMessagesFromIntent(intent);


for (SmsMessage currentMessage : messages){
sb.append("Received compressed SMS\nFrom: ");

sb.append(currentMessage.getDisplayOriginatingAddress());
sb.append("\n----Message----\n");

sb.append(currentMessage.getDisplayMessageBody());
}
}

Log.i(LOG_TAG, "[SMSApp] onReceiveIntent: " + sb);


Toast.makeText(context, sb.toString(), Toast.LENGTH_LONG).show();


this.abortBroadcast();


Intent i = new Intent(context, SMSActivity.class);
i.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
context.startActivity(i);
}
}
}

plusminus wrote:Hello mjpan,

did you try the Category-Thing :?:

There is no official Bug-Tracking-System yet, but on my Bugs posting them to the GoogleGroups and hoping a moderator would see them was fine ^^.

Regards,
plusminus
dkkundudolan
Experienced Developer
Experienced Developer
 
Posts: 83
Joined: Mon Mar 03, 2008 12:50 pm

Re: Recognize/React on incoming SMS

Postby Ghalya » Wed Mar 19, 2008 6:53 pm

thx :wink:
Ghalya
Freshman
Freshman
 
Posts: 9
Joined: Sat Feb 09, 2008 4:07 pm
Location: Dubai, UAE

Postby ryank » Fri Apr 04, 2008 12:50 am

Great tutorials +/-!

I have read a number of posts on here regarding sending/recieving SMS messages. I am wanting to send xml from my app on one phone (emulator) to my app on another phone. Is the best way to do this using SMS?

If so, it sounds like I might want to use eclipse to simulate the send? Is that correct? If so, how can I verify the communication works as expected? Please let me know if I am misunderstanding.

Also, in order for my app to recieve the intent, does the user need to have my app running? Or do I need to implement as a service or something?

Thanks!
ryank
User avatar
ryank
Developer
Developer
 
Posts: 43
Joined: Mon Jan 28, 2008 3:23 am

Postby AMGG » Mon Apr 07, 2008 8:08 pm

Hi!

First of all (this is my first post since I registered in the page) congratulations plusminus for this great web, and many thanks for share your knowledge.

I'm trying the "Post reply" tutorial, but when I send a sms from the console (sms send <tlf number> <text>) nothing happens in the emulator.

Should I make some kinda registration of the app in the emulator? or launch the emulator with a special params?

My code is just a merge between your PostReply and FriendFinder tutorials. I mean, when I receive a msg I want to launch the FriendFinder app. But nothing happens.

Here is my manifest:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.    package="es.home.learn.friendFinder">
  7.  
  8.    
  9.  
  10.     <uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
  11.  
  12.     <uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
  13.  
  14.  
  15.  
  16.     <uses-permission android:name="android.permission.ACCESS_LOCATION"></uses-permission>
  17.  
  18.     <uses-permission android:name="android.permission.ACCESS_GPS"></uses-permission>
  19.  
  20.    
  21.  
  22.     <application android:icon="@drawable/icon">
  23.  
  24.         <activity android:name=".FriendFinder" android:label="@string/app_name">
  25.  
  26.             <intent-filter>
  27.  
  28.                 <action android:name="android.intent.action.MAIN" />
  29.  
  30.                 <category android:name="android.intent.category.LAUNCHER" />
  31.  
  32.             </intent-filter>
  33.  
  34.         </activity>
  35.  
  36.         <activity android:name=".FriendFinderMap" android:label="@string/map_title">
  37.  
  38.                 <intent-filter>
  39.  
  40.                         <action android:name="android.intent.action.VIEW" />
  41.  
  42.                         <category android:name="android.intent.category.DEFAULT"/>
  43.  
  44.                 </intent-filter>
  45.  
  46.         </activity>
  47.  
  48.          <receiver android:name=".SmsReceiver">
  49.  
  50.                 <intent-filter>
  51.  
  52.                         <action android:name="android.provider.Telephony.SMS_RECEIVED"/>                       
  53.  
  54.                 </intent-filter>
  55.  
  56.         </receiver>
  57.  
  58.                        
  59.  
  60.     </application>
  61.  
  62. </manifest>
Parsed in 0.005 seconds, using GeSHi 1.0.8.4


Thanks!
AMGG
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Jan 15, 2008 11:46 pm
Location: Barcelona

Re: Recognize/React on incoming SMS: HELP

Postby bjreddi » Fri Apr 25, 2008 11:56 am

Plusminus,

Thank you very much in tutoring us with very good applications.

I have tried the example that u have posted. "Rect on incoming SMS"

I have two Java classes SMSActivity.java, SMSReceiver.Java. I just copied and ur code and ran the application.

I got this note when i ran the application:

"Helloworld, SMSActivity"

I didnt get any SMS received notification.

I did the way u mentioned in the tutorial.

I have no errors at all. But how to get the Notification. Please help me.

Regards,
Jyothi
bjreddi
Junior Developer
Junior Developer
 
Posts: 17
Joined: Thu Apr 03, 2008 1:24 pm

Top
PreviousNext

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 8 guests