Ionic/Angular: How to exit application on pressing hardware back button

  Рет қаралды 2,772

Better-Coding

Better-Coding

Күн бұрын

The following tutorial explains how to override standard hardware back button behaviour by custom logic in three scenarios:
1. Exit an application on pressing hardware back button
2. Exit an application on pressing hardware back button with confirmation popup
3. Exit an application on pressing hardware back button twice within 2 seconds
--
Post on my blog: better-coding....
Git repository: gitlab.com/bet...
My IT blog: better-coding....
My personal blog: lukaszciesla.com/
My discord: / discord
Gitlab: gitlab.com/bet...

Пікірлер: 23
@patricioblancotolentino5839
@patricioblancotolentino5839 2 жыл бұрын
Nice video!
@shirazshakeel8669
@shirazshakeel8669 2 жыл бұрын
Was struck on this thing but your tutorial helped a lot. May God bless you and looking forward to more videos like this. ❣
@Leo-vj6df
@Leo-vj6df 3 жыл бұрын
Thank you a lot for your video, It helps me a lot. I'm gonna subscribe now. Do more videos about ionic, you will always get my like. :)
@forcaweb
@forcaweb 3 жыл бұрын
Muito obrigado vc me ajudou muito a dias que queria uma solução!
@lcho9871
@lcho9871 2 жыл бұрын
Is it possible to exit the App without press the back button like ???.exitApp() directly inside the code? Thanks...
@jackowen7017
@jackowen7017 3 жыл бұрын
nice work
@devaldiakbars6769
@devaldiakbars6769 3 жыл бұрын
Hi, is your blog under maintenance? I cannot access ..
@Mr.Thenula2011
@Mr.Thenula2011 3 жыл бұрын
Hi mate, nice tutorial, can you show how to set a custom button with back button behavior, let say I have a button on-screen with an icon I need it to behave the same as the hardware back button you showed in your video
@BetterCoding
@BetterCoding 3 жыл бұрын
Hi Roshan! Here is the video you asked: kzbin.info/www/bejne/pX-ahH6nqtGbntk
@ciprian-danielturca3067
@ciprian-danielturca3067 2 жыл бұрын
Hi, and thank you for your tutorial. I tried to exit application if it's in background for more than 30 minutes using navigator['app'].exitApp(). When the exit event it's triggered the application it's refreshed, and rest in background. Do you know why that happend and the application it's not fully closed? Any help will be great. Thank you!
@BetterCoding
@BetterCoding 2 жыл бұрын
Did you try to use Platform.exit()?
@ciprian-danielturca3067
@ciprian-danielturca3067 2 жыл бұрын
@@BetterCoding Does not exist any exit method on Platform or this.platform.
@BetterCoding
@BetterCoding 2 жыл бұрын
@@ciprian-danielturca3067 are we talking about ios app or Android one? The solution works with Android.
@ciprian-danielturca3067
@ciprian-danielturca3067 2 жыл бұрын
@@BetterCoding I'm working with Angular an Ionic 5. In Ionic 5 Platform.exit() not exist. The application it's for both, Android and iOS.
@BetterCoding
@BetterCoding 2 жыл бұрын
@@ciprian-danielturca3067 but navigstor['app'].exitApp() may work only on Android, because on IOS you don't realy kill the application AFIK. Its still running
@andresdanielvelizobregon
@andresdanielvelizobregon 2 жыл бұрын
i have problem with ionic 6, not work. Help me please
@BetterCoding
@BetterCoding 2 жыл бұрын
I will check it out tonight
@devaldiakbars6769
@devaldiakbars6769 3 жыл бұрын
Is will be work in IOS version too ?
@BetterCoding
@BetterCoding 3 жыл бұрын
Hi. There is no such thing like back button on IOS, but yes - the code is written on such way that if the button existed, the code would work. I lost my blog during last fire of Strassburg data center. I'll try to bring it up to work soon.
@devaldiakbars6769
@devaldiakbars6769 3 жыл бұрын
@@BetterCoding Yeah thank you for confirmation
DHH discusses SQLite (and Stoicism)
54:00
Aaron Francis
Рет қаралды 63 М.
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 58 МЛН
1ОШБ Да Вінчі навчання
00:14
AIRSOFT BALAN
Рет қаралды 6 МЛН
NSURLProtocol: How I Stole an App For My Wedding
56:25
Bryce Bostwick
Рет қаралды 19 М.
Generate Custom Icon & Splashscreen with Ionic 7 & Capacitor 5
13:58
Coding Technyks
Рет қаралды 21 М.
Unity3D: Build Flexible detector script using UnityEvent system
6:33
Senior Angular Developer Interview (theory)
41:57
WeCoded
Рет қаралды 20 М.
Postgres just got even faster
26:42
Hussein Nasser
Рет қаралды 24 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 187 М.
Ionic 7 : How to exit the App using hardware back button
4:20
TechBinomial
Рет қаралды 1,9 М.
I built the same app 10 times // Which JS Framework is best?
21:58
Fireship
Рет қаралды 2,5 МЛН