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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:22:28+00:00 2026-05-23T03:22:28+00:00

I am using time picker for my app which sends sms based on a

  • 0

I am using time picker for my app which sends sms based on a particular time in future. I have the sms sending part ready using sms manager. I also have the user time using getCurrentHour() and getCurrentMinute(). This is my code

 if(phoneNo.length()>0&&message.length()>0)
    {
     sendSMS(phoneNo,message);
    }
      else        
      {
       Toast myToast=Toast.makeText(getBaseContext(),"Please enter both phone number and message.",Toast.LENGTH_SHORT);
       myToast.show();
        }
      }
  });
}

How do I proceed to send the sms at a particular time?

  • 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-23T03:22:29+00:00Added an answer on May 23, 2026 at 3:22 am

    You’ll need to move your sendSms() method in to a Service, and then use AlamManager to cause your Service to be woken at the correct time, and send your SMS.

    You will need to define your Service:

    class SmsService extends IntentService
    {
        @override
        void onStartCommand( Intent intent, int flags, int startId )
        {
            String number = intent.getStringExtra( "number" );
            String message = intent.getStringExtra( "message" );
    
            // Send your SMS here
        }
    }
    

    You’ll need declare this service in your manifest:

    <service android:name=".SmsService">
        <intent-filter>
            <action android:name="mypackage.SEND_SMS" />
        </intent-filter>
    </service>
    

    Finally you’ll need to set the alarm which will wake up at the given time and send your message:

    AlarmManager mgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
    Intent intent= new Intent( "mypackage.SEND_SMS" );
    intent.setExtra( "number", number );
    intent.setExtra( "message", message );
    PendingIntent pi = PendingIntent.startService( this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT );
    mgr.set( AlarmManager.RTC_WAKEUP, time, pi );
    

    This will need to be called from within an Activity or Service which has either extends or has access to a Context.

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

Sidebar

Related Questions

I am making an iPhone app in which I am using date time picker
This should hopefully be a simple one. When using a date time picker in
I am creating time picker using a JSpinner . The text inside the JSpinner
I am currently using a date and time picker to retrieve a user-submitted date
I have an application which I am developing using WPF\Prism\MVVM. All is going well
I am creating an iPhone app which I would like to have a similar
I'm using the time picker control from the following link: http://fgelinas.com/code/timepicker/timepicker.html It works super
I'm using the time picker control from the following link: http://fgelinas.com/code/timepicker/timepicker.html It works super
I'm trying to get selected dates using two date and time picker (like fromdate
i have some problems in using the date picker from xml layout. in my

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.