hey dear,

            i want to fetch my inbox message while it goes run m going
threw this code but can't be able to fullfill it can u help meplease
need wuick responce dear. m writiing this code in apidemos.java
my mail id is akhil.andr...@gmail.com


<manifest xmlns:android="http://schemas.android.com/apk/res/android";

    package="org.apache.sms">

    <uses-permission id="android.permission.RECEIVE_SMS" />

    <application>

        <receiver class="SMSApp"

            <intent-filter>

                <action
android:value="android.provider.Telephony.SMS_RECEIVED" />

            </intent-filter>

        </receiver>
    </application>

</manifest>
package org.apache.sms;

import android.app.ListActivity;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentReceiver;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.provider.Telephony:
import android.util.Log;
import android.telephony.gsm.SmsManager;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SMSApp extends IntentReceiver {

         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 &lt; messages.length; i++) {

                            SmsMessage message = messages[i];

                            buf.append("Received SMS from  ");

        
buf.append(message.getDisplayOriginatingAddress());

                            buf.append(" - ");

                            buf.append(message.getDisplayMessageBody());

                        }

                    }

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

                    NotificationManager nm = (NotificationManager)
context.getSystemService(

                            Context.NOTIFICATION_SERVICE);



                    nm.notifyWithText(123, buf.toString(),

                            NotificationManager.LENGTH_LONG, null);



                }

            }



            private void appendData(StringBuilder buf, String key, String
value) {

                buf.append(", ");

                buf.append(key);

                buf.append('=');

                buf.append(value);

            }

        }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to