Enable and disable Android alarms via code

1

I'm creating an application, and in some parts I'll need the app to turn on and turn off alarms (from my phone itself). I searched the internet but did not find anything that would help me not described. I do not know which classes or library can be used and if it's really possible.

    
asked by anonymous 20.02.2018 / 12:53

1 answer

2

You can not do this. It does not even have you pick up the list of all active alarms in the system, for example. Unless the app that initiated the alarm provides services for that, using ContentProvider for example.

What you can do is use Do not disturb . When your app starts, you launch an attempt by activating the dnd and when you close a one turns off.

This link can help you with implementation link

Remember that you will have to, depending on the version of android (6.0+), ask the user for permission to use this service.

    
21.02.2018 / 13:26