Android: Browser back button will not fire $getJSON event - android

I have a test project that uses $getJSON to pull data from web services like Geonames and our own proprietary services. The index page uses two $getJSON calls, and they load fine both when you first load the page or press the refresh. However, if you navigate to another page and then hit the back button to go back to the index page, the page begins reloading and just stops when it hits the $getJSON calls. I've read about Android browser not caching well with the back button in 2.1 (what I'm using)- I'm fine with page reloads as long as it actually completely loads the page.
I've tried this in Firefox and it caches the index page, so there's no re-running of the JSON calls. That's why I'm asking it here in an Android capacity- is it purely the no-caching back button thing that is the problem or is there something I could change about my $getJSON calls?
Here's the page:
http://MPulsemobile.info

My experience is that the Android browser does not report events for the back button like other browsers.
Imagine you have a form containing a text field, and the text field contains, say, 3 characters.
Create a JavaScript alert that will fire on keyup() and begin deleting characters. The alert will not fire until the final key up.

Related

Page dart call in loop without calling it anywhere

I am creating a mobile application in dart allowing the company to place orders directly via their phone, once the order is finished and paid a congrat page is displayed to inform the merchant that it worked, however once back on the application when I click on any input of any page the congrat page is redisplayed and re-debits the customer all this in a loop (4 times), I never call this page in my Ontap or OnClick event and the page is not imported either.
Do you have an idea ?
I thank you !
I have tried different ways of debugging but nothing works, I do not understand where the problem comes from knowing that on

Autofill service not populating user info into a form within a webview in my app

I looked at several issues and was unable to find one that matched mine; apologies ahead of time if I missed it!
I have a native app, a portion of which contains a webview. The webview leads to a page that has a login. When going to the login form android autofill suggestions will pop up and upon selecting them the login process "appears" to initiate however, I'm not actually seeing my onSubmit function firing from the page contained within the webview and ultimately the page returns to the login page as the user is not actually authed. I'm also not seeing the user items populated in the contained webpages state.
Any ideas on why the autofill items are not populating in the form within the webview? Any other things I can try to debug this?
For my particular case, I was actually changing the webview's HTML in the onPause() lifecycle event to ensure the webview stopped hitting our backend; something that was creating incorrect usage stats. This functionality should actually have been placed in the onStop() as it is:
The behavior I actually wanted as I only needed to change the HTML when my app is not visible to the user.
The autofill service triggers onPause() thus making it so the HTML would be changed when the app was still visible and thus, the HTML android was trying to autofill was no longer present.

How to determine if Webview in React Native Single Page Application can go back on Android?

Suppose we have an Android app, then we can call canGoBack() to determine if the back button should go back or exit the app.
Suppose we have a RN Android app that is a multi page application, then onNavigationStateChange() will return if canGoBack is true or false.
But if it is an RN single page application, onNavigationStateChange is not fired on clicking a link.
There is a workaround shared here, which involves overriding history.pushState.
I was also thinking of querying the source/url/html properties of the webview but somehow they all return null. I'm not sure if this is expected or not.
Are there any better solutions to understanding if the back button should exit the app or bring the user to the previous screen?

android back button in an embedded browser webview

Folks
I have an activity that launches an embedded browser view rendering stuff that is out of my control. Now suppose the user navigates one more level by clicking on a link in the browser view. This opens a new browser window. In order for the user to go back to prior activity, the user would have to click back "twice".
I would like to implement a "soft" back button that always shows up at the top of the embedded browser view.
I found the question answered at Android WebView, how to handle redirects in app instead of opening a browser
But when I use that solution, the android native button also takes you back directly to the prior activity (instead of going back in history of the page). Is there a way so that I can do both (have a custom back button that takes me back all the way but have the android native back retain the expected behavior of going back one page at a time?
Thank you!
I would like to implement a "soft" back button that always shows up at the top of the embedded browser view.
This will be pointless in your current implementation. As you state:
Now suppose the user navigates one more level by clicking on a link in the browser view. This opens a new browser window.
Note the key phrase here is "a new browser window", referring to the user's default choice of browser app. You cannot "implement a 'soft' back button that always shows up at the top of" the user's default choice of browser app. While you could put a Button alongside your WebView, that Button will only be visible when the activity containing the WebView is, and there, the user can press the ordinary hardware BACK button to exit that activity.
But when I use that solution, the android native button also takes you back directly to the prior activity (instead of going back in history of the page).
That is because there is only one activity, and the BACK button does not automagically have meaning for an activity with a WebView. For example, suppose the activity had two WebViews -- which one would BACK handle?
Is there a way so that I can do both (have a custom back button that takes me back all the way but have the android native back retain the expected behavior of going back one page at a time?
You can override onBackPressed() (or onKeyDown() for pre-Android 2.0) to get control when the hardware BACK key is pressed. You can use that to move back in the WebView history, or if there is no history, allow the normal processing (finish()) to occur.
I would recommend an action bar for allowing users to switch to some other mode of your app. Action bars are part of Honeycomb, and there are open source implementations you can use for earlier versions of Android.

Android - WebView dies on resume

I have Activity with some data displayed in WebView that I load with WebView#loadDataWithBaseURL
Then I have/click menu option that fires android.content.Intent.ACTION_SEND
Choose email from the chooser
Google email comes up (as expected)
Discard email and hit back button
Action with WebView tries to resume
Bang - I get NullPonterException at line 4380 in WebView.java if (mWebViewCore.getSettings().getNeedInitialFocus()) since mWebViewCore is now null
The only place in code where mWebViewCore is nullified is at WebView#destroy - how do I recover from this? Do I need to recreate the browser and load my data all over again, that seems pretty wasteful? I really appreciate good suggestion at this point
Well, I can tell you that I just tested using a WebView with loadDataWithBaseURL(), where the page I loaded had a link. Clicking on the link brings up the Browser application, as expected. BACK button-ing out of the Browser brings back my app with the WebView just fine, no exceptions.
So, either ACTION_SEND/Gmail are somehow special, or there is something more going on with your app.
Can you replicate the problem in a small project that you can post somewhere?

Categories

Resources