Unable to handle back button navigation issue in hybrid apps - angularjs

We have developed an hybrid app using phonegap in pure HTML stack (HTML, css, javascript). Currently we are facing issue with device back button navigation. Generally in any native apps such as android, on pressing back button the app moves to first screen and then exits the application or exits directly. But, we are not sure on how to handle this behaviour in angular js. As per current behaviour, in our application on pressing back button, it moves to previous screen and then to its previous and thereby navigates to different screens without exiting. So, we are not sure on how to handle this behaviour.

document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown(e) {
e.preventDefault();
}
in the onBackKeyDown method, navigate where you want or your login.

Related

Detect when a page loads in React

Is there a callback that is called when a react "page" finishes loading?
BACKGROUND: I have an Android webview that does some stuff when the page fully loads. It works great for normal web pages, but for react apps the webview only triggers the "loadComplete" callback when the app loads for the first time. I'd like to detect something similar for React apps, especially after the Back button is pressed.

How to detect back navigation triggered by swiping and stop it on iOS?

I have a form in my react native app. When a user tries to fill it and tries to navigate back without saving it. I would like to show an alert to confirm this action. If the user decides to submit this form, the triggered back action must be canceled. On Android, the back button can be controlled with an event listener. But how can we achieve that on iOS using react navigation?
It's not possible currently. However, you could disable the swipe gesture on the screen instead.

Ionic + Angular UI-Routing: How to delete Back Stack?

Im working with the Ionic-Framework and AngularJS.
If you create the Ionic sidemenu sample project:
ionic start myApp sidemenu
You will get a small example application which shows my exact problem.
You can try out the behaviour here: Plunker
If you open up the Side-Menu and navigate to several locations everything
is put on the Back-Stack. How can I prevent that behaviour for special pages?
For our example lets say i always want to completely delete the Back-Stack
when the "playlists" page is called. My Application will run on mobile devices only and its very untypical to be able to press the back button in the main menu and be navigated to the last opended page.
I want Angular UI-Routing to simulate the Android Backing behaviour.
How can i achieve that?
Another problem is that the hardware back button seems to work different than the back button of the navigation bar. You can see that in the browser. If you navigate to a link from the side menu there wont appear a back button in the navigation bar (Like it should be!). But when you press the browser back button, suddenly a back button in the navigation bar appears (very uncool!). How to prevent that?

Silverlight and the back button

Is there a way to override the behavior of the back button in the browser when using a Silverlight app?
Essentially what I want to do is use the browser's back button to close dialogs in my application. The dialog covers the whole screen and the user would be inclined to think they are on a separate web page.
Look to the following links:
Prevent Browser Back Button for Silverlight with Confirm Dialog.
Silverlight - Prevent users from losing changes by using the browser back button
Managing Silverlight 3 navigation
behavior

Windows phone 7 silverlight tombstoning

I have read in requirements that when user presses the back button, application must exit.
(5.4.2): "Pressing the Back button from the first screen of an application must exit the application".
So, i have read in many sites that exitting in silverlight is not available, but i think that they mean, that application should only deactivate (for example, it is deactivated when we press button with "windows flag").
I have a main menu in my application. If i navigate on another pages and return to main menu, pressing "back button" doesn't deactivate application because previous pages are another pages in application. So, maybe I need to clean "navigation history" ? But it is not possible, i have readed it somewhere...
so, what to do in this case?
The back button must exit the application from the first screen in your application. Your application is supposed to navigate backwards through your page stack if the user has navigated forwards through your pages.
This requirement simply means that you application must not prevent the user from exiting the application when the press the back button and have reached the first page.
First off, there is no explicite exiting in Silverlight. There is no Exit() method.
Think of your app as a webapp and whole navigation system is like a simple browser with back, home and search button.
Can you close stackoverflow.com ? you can back to another site (if any) or press start/home button to leave stackoverflow (if it's not your home page :) )
In Windows Phone 7 the behaviour you describe as "deactivate" is called Tombstoning.
You can use Non-linear Navigation Service to solve your problem with navigation.

Resources