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 6733939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:49:48+00:00 2026-05-26T10:49:48+00:00

I want to develop a sms application which send automatic sms to the sms

  • 0

I want to develop a sms application which send automatic sms to the “sms sender” when receive a sms, with a predefind text.
First i created the broadcast receiver class

public class MyBroadCastReceiver extends BroadcastReceiver {
private final String MSG_BODY="Thank you for contact we will contact u later";
final int MAX_SMS_MESSAGE_LENGTH=160;
@Override
public void onReceive(Context context, Intent intent) {
    if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED"))
    {

            Bundle bundle = intent.getExtras();           //---get the SMS message passed in---
            SmsMessage[] msgs = null;
            String msg_from;
            if (bundle != null){
                //---retrieve the SMS message received---
                try {
                    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]);
                        msg_from = msgs[i].getOriginatingAddress();

                    }
                        Toast.makeText(context, "SMS sent",
                              Toast.LENGTH_SHORT).show();
                        //String msgBody = msgs[i].getMessageBody();

                    msg_from = msgs[0].getOriginatingAddress();
                    sendSms(msg_from,MSG_BODY);
                    }

                    catch(Exception e){Log.d("Exception caught",e.getMessage());}
                }
            }   
}
 private void sendSms(String phonenumber,String message)
    {
        SmsManager manager = SmsManager.getDefault();


                int length = message.length();

                if(length > MAX_SMS_MESSAGE_LENGTH)
                {
                        ArrayList<String> messagelist = manager.divideMessage(message);

                        manager.sendMultipartTextMessage(phonenumber, null, messagelist, null, null);
                }
                else
                {
                        manager.sendTextMessage(phonenumber, null, message, null, null);
                }
        }
    }

And the manifest file is

<?xml version="1.0" encoding="utf-8"?>
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.myapp"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<receiver android:enabled="true"     

   android:name="com.myapp.MyBroadCastReceiver">   
   </receiver>
    <activity android:name=".MeraSms"
              android:label="@string/app_name">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

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

It does nothing only display my main activity.
Help me where i am going wrong.

  • 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-05-26T10:49:48+00:00Added an answer on May 26, 2026 at 10:49 am

    Try adding an intent-filter into the receiver. “android.provider.Telephony.SMS_RECEIVED” is an ordered broadcast intent, which means a receiver with a higher priority may block receivers with lower priority.

    <receiver android:enabled="true" android:name="com.myapp.MyBroadCastReceiver">   
      <intent-filter android:priority="10000">
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
      </intent-fileter>
    </receiver>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to develop an Android application which can run on all ,screen type
I need to develop the SMS based application. I want to read the new
I want to develop an chat application, in which I successfully added files of
I want to develop an ASP.NET application which will retreive the HOSTUUID from the
I want to develop a web application which makes it possible to browse an
I want to develop a windows application. If I use native C++ and MFC
I want to develop a mobile web application using asp.net 3.5 that can be
I want to develop an iPhone application using the utility template, where the flip
I want to develop an application that disables the Background Data (new feature in
I want to develop a web application, like an online scheduler. (Yes I know

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.