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

  • Home
  • SEARCH
  • 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 8610723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:11:50+00:00 2026-06-12T04:11:50+00:00

I want to add this facility into my app in which user can set

  • 0

I want to add this facility into my app in which user can set application start time and at that time application get started.
How can i use broadcast receiver to open my app at user specific time.
I am not sure this is possible in android or not?
if you have any idea than please share.
Here is main activity code

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    lv1=(ListView)findViewById(R.id.listView);
    final ImageView splashImage = (ImageView) findViewById(R.id.imageView1);
    splashImage.setBackgroundResource(R.layout.splash);
    AnimationDrawable  splashAnimation = (AnimationDrawable) splashImage.getBackground();
    splashImage.onWindowFocusChanged(true);
    splashAnimation.start();    
    AlarmManager am = (AlarmManager) getBaseContext().getSystemService(Context.ALARM_SERVICE);
    Date futureDate = new Date(new Date().getTime() + 86400000);
    Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MINUTE, 1);// start app in 1 min again
    futureDate.setHours(0);
    futureDate.setMinutes(0);
    futureDate.setSeconds(20);
    Intent intent = new Intent(getBaseContext(), MyAppReciever.class);
    PendingIntent sender = PendingIntent.getBroadcast(getBaseContext(), 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    am.set(AlarmManager.RTC_WAKEUP,cal.getTimeInMillis() , sender);}}

and this is reciver class code

class MyAppReciever extends BroadcastReceiver{ public void onReceive(Context context,Intent intent) {
startActivity(new Intent(context, Main_Activity.class));
}private void startActivity(Intent intent) {
// TODO Auto-generated method stub}}

I have added this line to manifest

<receiver  android:process=":remote" android:name="MyAppReciever"></receiver>

now my broadcast trigger but i got this error

10-02 17:56:27.735: E/AndroidRuntime(9020): java.lang.RuntimeException: Unable to instantiate receiver com.example.testgui.MyAppReciever: java.lang.IllegalAccessException: access to class not allowed

Thank you

  • 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-12T04:11:51+00:00Added an answer on June 12, 2026 at 4:11 am

    As @Paul D’Ambra said, you can do it with AlarmManager.

    Example:

    First you need to set the alarm:

    AlarmManager am = (AlarmManager) con.getSystemService(Context.ALARM_SERVICE);
    
    Date futureDate = new Date(new Date().getTime() + 86400000);
    
    
    futureDate.setHours(8);
    futureDate.setMinutes(0);
    futureDate.setSeconds(0);
    
    
    Intent intent = new Intent(con, MyAppReciever.class);
    
    PendingIntent sender = PendingIntent.getBroadcast(con, 0, intent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    

    Next You need to create a reciever with some code to execute(ie- starting your app):

    public class MyAppReciever extends BroadcastReceiver {
    
    @Override
    public void onReceive(Context context, Intent intent) {
    
        startActivity(new Intent(context, MyApp.class));
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my codes: <%=form_tag('/user_group_follows/follow',:id=>'follow_select_form',:remote=>true,:method=>:get) do %> <p>You want to add this user to?</p>
We alert user using this javascript, now i want to add this functionality to
I am making an application for iPhone. In that I want to add event
In my application i want add this feature . After open the application before
I want to add this attribute: data-show-url=<%= video_path(@video) %> to the HTML that this
I want to add this code: <link rel=stylesheet type=text/css href=css/global.css /> <!--[if lt IE
for example, I want to add this to jsfiddle.net jQuery Validation is this possible?
I want add new Feed item on entity persist and update. I write this
I want add my custom sidebar next right column all page. Please check this
NSUInteger wordInt = sentence.length; I want to add 1 like this -> wordInt =

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.