I know that it's possible to call activity on deleting notification by user with
Option 1 Use BroadcastReceiver for that purpose. Declare it in your
AndroidManifest.xml and pass
PendingIntent that will send broadcast to it. So you can use this call to run your function.
Option 2 Use Service or IntentService for that purpose. Again, just declare your service in
AndroidManifest.xml, and set up
PendingIntent accordingly. Then handle call inside service implementation in order to call your method.