Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Android)Added option to make a notification ongoing(so it can't be swiped away) #3165

Merged
merged 5 commits into from
Jul 10, 2020

Conversation

TheDutchDev
Copy link
Contributor

@TheDutchDev TheDutchDev commented Jun 27, 2020

Found this issue(#1147) while looking for a solution myself, didn't find one so decided to add my own based on the information given in that issue.

One can specify whether they want the notification to be ongoing(so it can't be swiped away) from the javascript side now.

Example(copy-pasted mostly from the docs):

const notifs = await LocalNotifications.schedule( {
    notifications: [
        {
            title: "Title",
            body: "Body",
            id: 1,
            schedule: { at: new Date( Date.now() + 1000 ) },
            sound: null,
            attachments: null,
            actionTypeId: "",
            extra: null,
            ongoing: true, // << The new bit
            autoCancel: false // << see edit below
        }
    ]
} );

EDIT: Also added option to set autoCancel manually. default is still set to true as it was before.

@TheDutchDev TheDutchDev changed the title Added option to make a notification ongoing(so it can't be swiped away) (Android)Added option to make a notification ongoing(so it can't be swiped away) Jun 27, 2020
@carlpoole carlpoole merged commit 1ee51cd into ionic-team:master Jul 10, 2020
@carlpoole
Copy link
Member

Thank you for your contribution. I merged in master and tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants