laboiteaprog
|
Posted: February 07, 2010 17:03 by laboiteaprog
|
|
hi i'm beginning with android and i try to do some tutorial on the web this one is application who are notified when a sms is received <?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.me.androidapplicationtest">
<application>
<receiver android:name="MySMSMonitor">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission..RECEIVE_SMS">
</uses-permission>
</manifest>java class
package org.me.androidapplicationtest;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsMessage;
import android.util.Log;
public class MySMSMonitor extends BroadcastReceiver {
private static final String ACTION = "android.provider.Telephony.SMS_RECEIVED";
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null && intent.getAction() != null
&& ACTION.compareToIgnoreCase(intent.getAction()) == 0) {
Object[] pduArray = (Object[]) intent.getExtras().get("pdus");
SmsMessage[] messages = new SmsMessage[pduArray.length];
for (int i = 0; i < pduArray.length; i++) {
messages[i] = SmsMessage.createFromPdu((byte[]) pduArray[i]);
}
System.out.println("test ok");
Log.d("MySMSMonitor", "SMS Message Received.");
}
}
}
when i start this program i get: About to start org.me.androidapplicationtest/
DDM dispatch reg wait timeout
Can't dispatch DDM chunk 52454151: no handler defined
Can't dispatch DDM chunk 48454c4f: no handler defined
Can't dispatch DDM chunk 46454154: no handler defined
Can't dispatch DDM chunk 4d505251: no handler defined
usage: am [subcommand] [options]
start an Activity: am start [-D] <INTENT>
-D: enable debugging
send a broadcast Intent: am broadcast <INTENT>
start an Instrumentation: am instrument [flags] <COMPONENT>
-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT)
-e <NAME> <VALUE>: set argument <NAME> to <VALUE>
-p <FILE>: write profiling data to <FILE>
-w: wait for instrumentation to finish before returning
start profiling: am profile <PROCESS> start <FILE>
stop profiling: am profile <PROCESS> stop
<INTENT> specifications include these flags:
[-a <ACTION>] [-d <DATA_UR[quote]I>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEG[/quote]ORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>] [-f <FLAGS>] [<URI>]
Error: Bad component name: org.me.androidapplicationtest/
run:
BUILD SUCCESSFUL (total time: 1 minute 23 seconds)
i use telnet to connect to the vm instanance telnet localhost 5554 after i send a message with sms send 4506777228 test the string who are supposed to be displayed by System.out.println("test ok");
Log.d("MySMSMonitor", "SMS Message Received.");are not displayed when i send the message in console, i see the vm receive it.. any idea? |
bad compoment name, receiver
Replies: 0 - Last Post: February 07, 2010 17:03
by: laboiteaprog
by: laboiteaprog
showing 1 - 1 of 1
Replies: 0 - Last Post: February 07, 2010 17:03
by: laboiteaprog
by: laboiteaprog






