Hi.
Hope someone can help with this. This quite simple code is not working
and I don't know why.
It is supposed to receive incoming SMS intents and write some words to
logcat and display a Toast.
DDMS reports "com.example" process being created when I send a sms,
but nothing else happens.
The manifest:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0"
package="com.example" xmlns:android="http://schemas.android.com/apk/
res/android">
<uses-sdk android:minSdkVersion="4" />
<application android:icon="@drawable/icon" android:label="@string/
app_name" android:enabled="true">
<receiver android:name=".SmsReceiver" android:enabled="true"
android:exported="true" android:priority="999">
<intent-filter>
<action
android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
</manifest>
The code:
package com.example;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.Context;
import android.util.Log;
import android.widget.Toast;
public class SmsReceiver extends BroadcastReceiver {
/**
* @see android.content.BroadcastReceiver#onReceive(Context,Intent)
*/
@Override
public void onReceive(Context context, Intent intent) {
Log.d("SMS","hey you");
Toast.makeText(context, "hey you", Toast.LENGTH_LONG);
}
}
The emulator run android 2.2.
I'm going crazy.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en