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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:13:48+00:00 2026-05-30T02:13:48+00:00

I have a BootReceiver and is using android.intent.action.BOOT_COMPLETED to reconfigure whatever alarms the user

  • 0

I have a BootReceiver and is using android.intent.action.BOOT_COMPLETED to reconfigure whatever alarms the user made in my app, before phone was powerd off.

Im using AlarmManager to set the alarms again. The alarms are stored in a SQLite database.

public class BootReceiver extends BroadcastReceiver {

private Context mContext;   

@Override
public void onReceive(Context c, Intent intent) {
    mContext = c;

try {
        cursor.moveToFirst();
        do {
            Intent i = new Intent(mContext, AlarmReceiver.class);
            i.putExtra("alarm_message", cursor.getInt(1));
            PendingIntent pendingIntent  = PendingIntent.getBroadcast(mContext, (int)System.currentTimeMillis(), intent, PendingIntent.FLAG_ONE_SHOT);
            AlarmManager am = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
            am.set(AlarmManager.RTC_WAKEUP, cursor.getLong(4), pendingIntent);
            Log.e("DB", "Future alarms was set after reboot");
        } while (cursor.moveToNext());
    } catch (Exception e1) {
        Log.e("DB", "DB is empty");
    }
    cursor.close();

But when alarm is about to occur, the logcat gives me this:

Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=-1, uid=10067
Unable to send startActivity intent
W/ActivityManager(1584): java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=-1, uid=10067
02-19 23:42:26.989: W/ActivityManager(1584):    at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:10310)
02-19 23:42:26.989: W/ActivityManager(1584):    at com.android.server.am.ActivityManagerService.broadcastIntentInPackage(ActivityManagerService.java:10587)
02-19 23:42:26.989: W/ActivityManager(1584):    at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:228)
02-19 23:42:26.989: W/ActivityManager(1584):    at com.android.server.am.PendingIntentRecord.send(PendingIntentRecord.java:177)
02-19 23:42:26.989: W/ActivityManager(1584):    at android.app.PendingIntent.send(PendingIntent.java:400)
02-19 23:42:26.989: W/ActivityManager(1584):    at com.android.server.AlarmManagerService$AlarmThread.run(AlarmManagerService.java:692)

So far, the only thing I have in my AlarmReceiver.class is:

public class AlarmReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    Log.v("AlarmReceiver", "Alarm received");

I have all the proper permissions

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

and set the receivers:

<receiver android:name=".AlarmReceiver"></receiver>
<receiver android:name=".BootReceiver">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED"/>
    </intent-filter>
</receiver>

I’ve seen exampels of during this with succes, but cannot get rid of that Permisson denial. What am I missing?

  • 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-30T02:13:48+00:00Added an answer on May 30, 2026 at 2:13 am
    @Override
    public void onReceive(Context c, Intent intent) {
    
        ...
    
        Intent i = new Intent(mContext, AlarmReceiver.class);
        i.putExtra("alarm_message", cursor.getInt(1));
        PendingIntent pendingIntent  = PendingIntent.getBroadcast(mContext, (int)System.currentTimeMillis(), intent, PendingIntent.FLAG_ONE_SHOT);
    
        ...
    }
    

    In your BootReceiver you are creating a PendingIntent and passing it the Intent that is received by onReceive(...) – look at the third parameter of getBroadcast(...) above.

    I’m guessing you mean to pass i as that parameter rather than intent.

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

Sidebar

Related Questions

I never reach BootReceiver?? In my manifest i have: <receiver android:name=.app.service.receiver.BootReceiver android:enabled=true> <intent-filter> <action
I have a blank HelloWorld Application: package tutorials.TestReceivers; import android.app.Activity; import android.os.Bundle; public class
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
have been trying couple of hours now to make my iphone app universal. The
Have some code: using (var ctx = new testDataContext()) { var options = new
Have a really weird one here. The app has two targets, just to be
Have any one tried to activate fancybox thumbnail gallery using a button or an
Have an app that can use tts to read text messages. It can also
Have a look at this code: #include <iostream> using namespace std; int main() {

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.