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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:56:35+00:00 2026-06-16T11:56:35+00:00

hi I am using phonegap local notification plugin in my android project. notification are

  • 0

hi I am using phonegap local notification plugin in my android project.
notification are working great.
i can delete a notification with ID
but in my app i have to delete all notification option, for which this plugin gives a method to cancelAll notification.
which is:-

    plugins.localNotification.cancelAll();

but this is not working.
i am using this plugin from here
https://github.com/phonegap/phonegap-plugins/tree/master/Android/LocalNotification
any help will be appreciated.

  • 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-16T11:56:36+00:00Added an answer on June 16, 2026 at 11:56 am

    I think this might be the answer to this one. As it says in the description of the cancelAllNotifications() method (LocalNotification.java line 124):

    Android can only unregister a specific alarm. There is no such thing as cancelAll. Therefore we rely on the Shared Preferences which holds all our alarms to loop through these alarms and unregister them one by one.

    However, take a look at the code where the cancelAllNotifications() method is called (line 59):

    } else if (action.equalsIgnoreCase("cancelall")) {
        unpersistAlarmAll();
        return this.cancelAllNotifications();
    }
    

    Here’s what unpersistAlarmAll() looks like (line 181):

    private boolean unpersistAlarmAll() {
    final Editor alarmSettingsEditor = this.cordova.getActivity().getSharedPreferences(PLUGIN_NAME, Context.MODE_PRIVATE).edit();
    
    alarmSettingsEditor.clear();
    
    return alarmSettingsEditor.commit();
    }
    

    What’s happening is that the alarmIds are being cleared from sharedPreferences before cancelAllNotifications() is called, effectively leaving no alarms to be canceled.

    I’m not sure where the best place to move the call to unpersistAlarmAll() is, and I’d be happy to get some suggestions. In the meantime I have moved it to within cancelAllNotifications(), after the result returned from alarm.cancelAll(alarmSettings) is tested (line 133), like so:

    if (result) {
        unpersistAlarmAll();
        return new PluginResult(PluginResult.Status.OK);
    

    So far this seems to be working fine. Perhaps another way to do this would be to scrap the whole unpersistAlarmAll() method and instead call unpersistAlarm(String alarmId) (line 168) after each individual alarm is successfully canceled.

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

Sidebar

Related Questions

i have implemented a local notification in my android app using phonegap localnotification plugin.
In my PhoneGap 1.3 offline app I'm using modified iOS local notification plugin found
I have been using phonegap.js with jqm to built a mobile android app. I
I'm learning PhoneGap and I tried to use the Notification Local Plugin , but
I'm using the phonegap localNotifications plugin which specifies that I can set a notification
I have an app that runs fine using android phonegap 1.2 and jqm 1.0,
I'm trying to alert notifications using phonegap's local Notification Plugin , and it alerts
I am using PhoneGap, jQuery mobile in Xcode. I have a local xml (data.xml)
I am using phonegap and developing html pages for android but I dont know
I am using the PhoneGap LocalNotification plugin, which allows me to set local notifications

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.