No Way to Prevent Local Notification on Android from Opening the Application
Bug Report
Plugin(s)
Capacitor Version
Latest Dependencies:
@capacitor/cli: 3.0.1
@capacitor/core: 3.0.2
@capacitor/android: 3.0.2
@capacitor/electron: 3.0.2
@capacitor/ios: 3.0.2
Installed Dependencies:
@capacitor/cli: 2.4.2
@capacitor/core: 2.4.2
@capacitor/android: 2.4.2
@capacitor/electron: not installed
Platform(s)
Android
Current Behavior
I am using Local Notification Action types and one of those types needs to run code but NOT open the app. Using the props destructive and foreground works to make ios notification actions not open the app but not android. Is there a similar way to make android actions not open the application?
Expected Behavior
When an action on a notification is clicked on android the action should not open the app if specified in the code.
Code Reproduction
This stack overflow shows the code: https://stackoverflow.com/questions/66093556/how-to-prevent-local-notifications-in-capacitor-js-from-opening-the-application?r=SearchResults
Other Technical Details
Additional Context
This plugins are for capacitor 3, you are still using capacitor 2. please, migrate to capacitor 3 and provide a sample app reproducing the issue.
There is no way right now I can upgrade to capacitor 3. Is it expected that android notification should be able to create an action without opening the app?
As I said above I will not be able to upgrade to capacitor 3. Is capacitor 2 not supported anymore? I will create a sample app using capacitor 2.
Here is the sample app you requested. I ended up using capacitor 3 to make this sample app though I still cannot update my teams code from v2 to v3 at this time.
Github project: https://github.com/brandiwerner/SampleCapacitorAndroidLocalNotifications
Capacitor Doctor Results:
Latest Dependencies:
@capacitor/cli: 3.1.1
@capacitor/core: 3.1.1
@capacitor/android: 3.1.1
@capacitor/ios: 3.1.1
Installed Dependencies:
@capacitor/core: 3.1.1
@capacitor/cli: 3.1.1
@capacitor/android: 3.1.1
@capacitor/ios: 3.1.1
Here are two videos showing the issue:
https://user-images.githubusercontent.com/17693648/125819572-dd789656-57a3-4931-b3aa-3746ac933c94.mp4
https://user-images.githubusercontent.com/17693648/125819774-3af7379c-df8a-4315-9fce-04506e7b2474.mp4
seeing same issue. any update?
@jcesarmobile Any update on if this is an expected issue or a bug?
Any update on this ? Obviously this is only an issue for Android as the 'destructive' flag on the action hooks up correctly for IOS. There doesn't seem to be any similar code for Android - thus the issue.
Any Update?
no updates?
I suggest you try NativeScript for Capacitor so you can use the NativeScript Local Notifications plugin, which seems much more mature than this one and has much better Android support.