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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:57:10+00:00 2026-06-10T19:57:10+00:00

I have developed an android app that automatically sends an SMS automatically to a

  • 0

I have developed an android app that automatically sends an SMS automatically to a device from which it receives an SMS.

My App is working fine on the emulator but when I run it on a real device (android mobile) then it only receives SMSs and does not sends a reponse automatically.

My code is as follows.

public class SMSReciever extends BroadcastReceiver {

    String address;
    String smsMe = "I Recieved Your SMS";

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();

        Object messages[] = (Object[]) bundle.get("pdus");
        SmsMessage smsMessage[] = new SmsMessage[messages.length];
        for (int n = 0; n < messages.length; n++) {
            smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
            address = smsMessage[n].getOriginatingAddress();
        }

        Toast toast = Toast.makeText(context,"Received SMS: " +
                 smsMessage[0].getMessageBody(), Toast.LENGTH_LONG);
        toast.show();
        SmsManager sms = SmsManager.getDefault();
        sms.sendTextMessage(address, null, smsMe, null, null);
    }
}

I don’t know what is the problem. And why it is not working properly on a real device.

  • 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-10T19:57:11+00:00Added an answer on June 10, 2026 at 7:57 pm

    Try this code to send sms.

    //---sends an SMS---
    private void sendSMS(String phoneNumber, String message)
    {        
        PendingIntent pi = PendingIntent.getActivity(this, 0,
            new Intent(this, class_name.class), 0);                
        SmsManager sms = SmsManager.getDefault();
        sms.sendTextMessage(phoneNumber, null, message, pi, null);        
    }    
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an android app that mainly targets smartphones. However in tablet emulator
I have developed a business app that runs fine on android phone. What do
I am working on an Android app that displays photos which are downloaded from
I have developed an Android app which I want to be available both as
I have developed an App that target version is 4 (Android 1.6) upto 7
I have developed an android application, which uses image files and strings from the
I have developed an android app that works great and i would like to
Right now, I have developed an android app that is available free on the
I have developed an Android App that contains a list of information. I want
i have developed an app that runs perfectly fine on the simulator but when

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.