Phonegap JQuery Mobile Android Back Button issues - android

I am using Phonegap and JQuery mobile to make an app that has a lot of dynamic content. There are a lot of pages that are created dynamically. I need to get the back button working in Android. From this post, back button problems with PhoneGap and Jquery-mobile in android, I set $.mobile.phonegapNavigationEnabled = true and now the button at least acts like I expect it to. It goes back in history, skipping over the dynamically created pages. Before I added that, it was jumping all over the place.
My question is, how do I get those dynamically created pages into the history so that when the Android back button is pushed, it will go back the right way?

Related

Android - WebView moveTaskToBack to go back to the previous page

Is it possible to use the soft button to go back to previous web page?
I know that when we use the android's normal internet App, the button is functioning properly.
However when I implement a simple app arranged WebView for the web surfing purpose, the soft button only works as a app shutting down operation not going to previous web page.
Oh, there kindly is a function named goBack();

IBM Worklight 6.0 - How to override the Back button?

I have developed a Worklight application Using Dojo 1.9. In my application for returning to previous view i am using a back button in my app's header.
Back Button Code
<div data-dojo-type="dojox.mobile.Heading"
data-dojo-props="label:'View2 Details',back:'View1', moveTo:'view1'" style="background-color: maroon">
</div>
Is it possible to use the device's back button to navigate to previous view? so that I can use both approaches in my app?
I am not familiar with the concept of "pages" in Dojo, however:
Yes, there is WL.App.overrideBackButton, that you can use to override the default Android Back button functionality (quitting the app) and instead call a callback that will load a different view.
Note that in order to restore the "quit" functionality when the app is in the index page, you will need to use WL.App.resetBackButton so that the user will be able to quit the app like how s/he is used to in Android.
As for how to handle a multi-page navigation with history, please see the relevant topic in this training module. You will have to adjust the code to that you use in Dojo.
Two alternate solutions:
The simplest would be to rely on Dojo Mobile's "bookmarkable"
feature. For details, see
https://dojotoolkit.org/reference-guide/dojox/mobile/bookmarkable.html.
Live example:
http://download.dojotoolkit.org/release-1.9.0/dojo-release-1.9.0/dojox/mobile/tests/test_bk_force-list.html. After transitioning from the home page, pressing browser's back
button on desktop browsers, or the back button of Android devices,
triggers a transition back to the initial view.
The saner solution for a relatively complex app requiring navigation
history management would be to build your app using dojox/app. See the documentation at http://dojotoolkit.org/reference-guide/1.9/dojox/app.html and the tutorials at https://dojotoolkit.org/documentation/tutorials/1.9/dojox_app/.

in Cordova 1.8.1 - Android history.back() not working

I am developing a phonegap application in which the app loads the external url(http://example.com) into webview. When I navigate through the screen using window.location.href. I cant able to go back to the previous screen using the soft back button that present in the webview itself.
The android hard back button closes the back(which is fine for now).
Can anyone help me out.
It is the same problem: If jquery mobile does not create history entries, the back-button from the android phone will terminate the app, because, there is no Activity to go back to.
If you go forwrd through your app, make a pushState: https://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_history
If you have history entries, your app will not close and hopefully the soft-back button will work.

phonegap / jquery mobile - iframe &the back button

I'm working on a Phonegap/jQuery Mobile Android app.
A particular piece of content involves displaying a page which is on our server. We have used an IFrame to display this, all works fine apart from the back button. If you click through a couple of pages within the IFrame and press the phone's back button the app goes back a page rather than the content within the iframe, which is an issue.
I'm guessing it would be really tricky to get around this, but does anyone have ideas or alternate methods of displaying a external site with back button use?
Probably you need to override the default onBack method, and provide your own.
You need to figure out how to simulate going back within the iFrame programmatically

Soft back button in Android using Webview

I'm writing an Android program using Webview that can use the hard back key on the device, no problem with this.
But when the program goes "outside" and navigates through HTML / Javascript pages inside the Webview "wrapper" it cannot handle properly an href="javascript:window.history.back();" button, because it does not go up one level, just goes back and forward the previous page.
What am I doing wrong?
The javascript.window.history.back() function is designed to move back one step in the browser history. It does not (even on android platforms) emulate a click of the device's back button.
I believe the WebView component intercepts a press of the device's back button to allow a user to navigate back though the history until the point that the WebView was created (i.e. the first page viewed).
These two functions are completely separate, defined in different languages and one cannot be used for the other. If you want to implement the functionality of the device's back button you will need to do this within the application code, not a web page (a call to onKeyPress() should do the trick).

Categories

Resources