I have strange behaviour with Ionic 5 Angular 10
.
My app have notification feature that allow user to navigate to specific page based on notification type. Unfortunately in Android device
i need to separate notification action based on app state (background or foreground). When app is in background
the Push Notification
shown, but when App running in foreground i modified my function using Local Notification
because idk why the Push Notification
did’nt work in Android foreground
.
Here is my local notification
handling code
Import
import { NavigationExtras, Router } from ‘@angular/router’;
import { ActionPerformed as LocalNotificationActionPerformed, LocalNotifications } from “@capacitor/local-notifications”;
Constructor
constructor (private router: Router) {}
Code
LocalNotifications.addListener(‘localNotificationActionPerformed’, (res: LocalNotificationActionPerformed) => {
let params: NavigationExtras = {
queryParams: {chatToEmployeeId: res.notification.extra.employeeId}
}
this.router.navigate([’/friend-list/chat’], params);
})
I have a button with property [disabled]
that using function to return true
or false
based on some condition.
<ion-textarea placeholder=“Type a message…” id=“newMsg” name=“newMsg” class=“message-input” rows=“1” autoGrow=“true” style=“max-height: 100px;” maxLength=“500” ngModel [(ngModel)]=“newMsg”>
<ion-button id=“sendMsg” [disabled]=“isDisabled()” class=“msg-btn” (click)=“sendMessage()”>
isDisabled() {
return this.newMsg == ‘’ ? true : false;
}
When user tap the notification from Push Notification
, it’s working fine. But, when user tap from Local Notification
, the button always disabled
, idk why, i’ve tried many different ways, but no one works for me.
1 post - 1 participant