Error in sending and receving sms

by Analdin Judy » Tue, 20 May 2008 07:20:43 GMT


Sponsored Links
 ere is the code i got from group to send and receiving message


a)I want to know what is actualy in the "main.xml"
b)How can i test this program?

package com.northvortex.sms;

import android.app.NotificationManager;
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;

/public class SMSReceiver
extends IntentReceiver
{
private static final String TAG_LOG = "SMSReceiver";

private static final int ID_NOTIFICACION = 0x1221;

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

@Override
public void onReceiveIntent(Context parContext, Intent parIntent)
{
NotificationManager elNotificador =
(NotificationManager)parContext.getSystemService(Context.NOTIFICATION_SERVICE);


if (parIntent.getAction().equals(ACCION) ==
true)
{
StringBuilder elContenido =
new StringBuilder();

Bundle losDatosExtras =
parIntent.getExtras();
if (losDatosExtras != null)
{
.
SmsMessage[] losMensajesSMS =
Telephony.Sms.Intents.getMessagesFromIntent(parIntent);

for (SmsMessage unMensaje : losMensajesSMS)
{
elContenido.append("Mensajes
SMS\n");
elContenido.append("enviado por:");

elContenido.append(unMensaje.getDisplayOriginatingAddress()
+
"\n");
elContenido.append("Mensaje:\n");


elContenido.append(unMensaje.getDisplayMessageBody());
}
}

// Registramos en la bitacora el evento.
Log.i(TAG_LOG, "onReceiveIntent: " + elContenido);

// Mostramos el mensaje utilizando el administrador
de
notificaciones
elNotificador.notifyWithText(ID_NOTIFICACION,
elContenido.toString(),
NotificationManager.LENGTH_LONG, null);

// Consumimos este Intent, de esa forma ninguna otra
aplicacion lo
notara.
this.abortBroadcast();

// Ahora intentamos gatillar una actividad
adicional.
Intent elIntento = new Intent(parContext,
SMSActivity.class);
elIntento.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
parContext.startActivity(elIntento);
}
return;
}

}


package com.northvortex.sms;

import android.app.Activity;
import android.os.Bundle;

public class SMSActivity
extends Activity
{
/**
* Esta clase es llamada la vez que la actividad es creada.
*/
@Override
public void onCreate(Bundle parICicle)
{
super.onCreate(parICicle);

setContentView(R.layout.ma



Error in sending and receving sms

by Justin (Google Employee) » Wed, 21 May 2008 21:27:46 GMT


 here is this sample from?

Cheers,
Justin
Android Team @ Google

On May 20, 12:20 am, "Analdin Judy" <[EMAIL PROTECTED]> wrote:
--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Error in sending and receving sms

by Analdin Judy » Thu, 22 May 2008 05:23:30 GMT


 >From the below link i got the sample,




Other Threads

1. Using SoundPool.load(FileDescriptor, ... ) to load a sound file

I think File Descriptors are only useful in the context of the
application, in other words, they are only valid for manipulating
files in the app's namespace (assets, etc)

-niko




-- 

2. Is it possible to draw to a home screen icon?

...and if animating the icon's not possible, would doing it as a
widget work?

-- 

3. upgrade android di LG GW620 dibatalkan......

4. oot : openoffice di n900

5. scrollView.scrollTo() speed control?

6. Need Help, Desktop Battery Charger Magic

7. Kaos Android Greets Jakarta & [WTS] Android Stickers Se