Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7773431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:08:03+00:00 2026-06-01T17:08:03+00:00

If I send an sms to someone which says UPDATE. so I can get

  • 0

If I send an sms to someone which says ” UPDATE”. so I can get the location of that person. I will make a Broadcast Receiver which will be active when any sms arrives. If it matches UPDATE then will send the location of the other user.

The Broadcast Receiver.

public void onReceive(Context context, Intent intent) 
{   
//this stops notifications to others
this.abortBroadcast();

//---get the SMS message passed in---
Bundle bundle = intent.getExtras();   
SmsMessage[] msgs = null;
String str = "";            
if (bundle != null)
{
//---retrieve the SMS message received---
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];            
for (int i=0; i<msgs.length; i++){
    msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);                
    str += "SMS from " + msgs[i].getOriginatingAddress();
    from = msgs[i].getOriginatingAddress();
    str += " :";
    str += msgs[i].getMessageBody().toString();
    msg = msgs[i].getMessageBody().toString();
    str += "\n"; 
}
if(checksomething){
    //make your actions
    //and no alert notification and sms not in inbox
}
else{
    //continue the normal process of sms and will get alert and reaches inbox
    this.clearAbortBroadcast();
}
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:08:04+00:00Added an answer on June 1, 2026 at 5:08 pm

    Do you need a service for getting your SMS????

    if yes

    in manifest:

    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    

    and your service:

    import android.app.Service;
    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.content.IntentFilter;
    import android.os.Bundle;
    import android.os.IBinder;
    import android.telephony.SmsMessage;
    import android.widget.Toast;
    
    public class SrvSmsListener extends Service {
    
        private BroadcastReceiver IncomingSMSReceiver = new BroadcastReceiver() {
            private static final String SMS_RECEIVED =
                    "android.provider.Telephony.SMS_RECEIVED";
    
            @Override
            public void onReceive(Context _context, Intent _intent) {
                if (_intent.getAction().equals(SMS_RECEIVED)) {
                    Bundle bundle = _intent.getExtras();
                    if (bundle != null) {
                        Object[] pdus = (Object[]) bundle.get("pdus");
    
                        SmsMessage[] messages = new SmsMessage[pdus.length];
                        for (int i = 0; i < pdus.length; i++)
                            messages[i] = SmsMessage
                                    .createFromPdu((byte[]) pdus[i]);
                        for (SmsMessage message : messages) {
                            String strPhoneNo = message.getOriginatingAddress();
                            String msg = message.getMessageBody();
    
                            if (msg.startsWith("UPDATE"))
                            {
                                // this stops notifications to others
                                this.abortBroadcast();
                                // do what you want
                            }
                        }
                    }
                }
            }
        };
    
        @Override
        public IBinder onBind(Intent arg0) {
            // TODO Auto-generated method stub
            return null;
        }
    
        @Override
        public void onCreate() {
            final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
            IntentFilter filter = new IntentFilter(SMS_RECEIVED);
            BroadcastReceiver receiver = IncomingSMSReceiver;
            registerReceiver(receiver, filter);
        }
    
        @Override
        public int onStartCommand(Intent intent, int flags, int startId) {
            return super.onStartCommand(intent, flags, startId);
        }
    
        @Override
        public void onDestroy() {
            if (IncomingSMSReceiver != null)
            {
                unregisterReceiver(IncomingSMSReceiver);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how i can send sms from asp.net?any idea about it?or any resource through which
I'm developing an application via which one can send sms by directing it to
how can i send sms message to a phone number so that it forwards
i am building this sms notification system, which will send 10 times free sms
Are there any sites that offer the ability to send SMS for free? How
I got a java class which is used to send SMS to a mobile
Possible Duplicate: How to programmatically send SMS on the iPhone? Does someone have an
Hi i want to send sms from ipod and also i will check whether
I am building an application which will send status requests to users (via email
Ok, so i am making a Android app that is able to send sms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.