Error code to sendSms

Put your problem here if it does not fit any of the other categories.

Error code to sendSms

Postby DoM » Mon Mar 16, 2009 1:00 pm

Hi everyone,
I have a problem with an import:
andriod.provider.Telephony;

the import cannot be roselved

I post you my code..

package com.android.sms;

import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.BroadcastReceiver;
import android.os.Bundle;
import android.provider.Contacts;
import android.provider.Telephony;
import android.util.Log;
import android.telephony.gsm.SmsMessage;
import android.widget.Toast;
import android.app.Activity;

public class SmsApp extends BroadcastReceiver {
private static final String LOG_TAG = "SMSApp";

/* package */ static final String ACTION =
"android.provider.Telephony.SMS_RECEIVED";

public void onReceiveIntent(Context context, Intent intent) {
if (intent.getAction().equals(ACTION)) {
StringBuilder buf = new StringBuilder();
Bundle bundle = intent.getExtras();
if (bundle != null) {
SmsMessage[] messages =Telephony.Sms.Intents.getMessagesFromIntent(intent);
for (int i = 0; i == messages.length; i++) {
SmsMessage message = messages[i];
buf.append("Received SMS from ");
buf.append(message.getDisplayOriginatingAddress());
buf.append(" Ciao ");
buf.append(message.getDisplayMessageBody());
}
}
Log.i(LOG_TAG, "[SMSApp] onReceiveIntent: " + buf);
NotificationManager nm = (NotificationManager) context.getSystemService(
Context.NOTIFICATION_SERVICE);

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

}
}

private void appendData(StringBuilder buf, String key, String value) {
buf.append(", ");
buf.append(key);
buf.append('=');
buf.append(value);
}
}
DoM
Freshman
Freshman
 
Posts: 9
Joined: Mon Mar 16, 2009 12:43 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 12 guests