Example of blocking Soft Back Button on android in angular component
import { Component, OnInit } from '@angular/core';
import { isAndroid } from '@nativescript/core/platform';
import { AndroidApplication, AndroidActivityBackPressedEventData } from "@nativescript/core/application";
import * as app from "@nativescript/core/application";
declare const android:any;
//Put this code in implementation OnInit of component
ngOnInit() {
if (isAndroid) {
app.android.on(AndroidApplication.activityBackPressedEvent, (data: AndroidActivityBackPressedEventData) => {
data.cancel = true; // prevents default back button behavior
});
}
}
Brak komentarzy:
Prześlij komentarz