Can I add some handle after user press Home button in android ?
Such as show modal ask user need to exit app or cancel.
I see this link Detect home button press in android can helpful.
But I do not know how to apply that code to MainActivity.java of android in react-native.
onUserLeaveHint is work after app close but I need modal work before app close.
Thank for any help.
I was able to solve it myself. I open sourced my solution here - https://www.npmjs.com/package/react-native-home-pressed Let me know what you think
Related
There is one case that I need to click one button that does the same thing like the 'home' button, just to hide the app, not exit the app.
Could you tell me how to write method to simulate the 'home' button in android and ios?
thanks.
I read somewhere and it seems like it is not possible for now.
I'm making a custom my own navigation bar which will have back, home and recent toggle apps. I'm not using the android provided buttons. I just want to make my own. I made the code for home and recent apps button but could not find code for back button. Anyone knows how to do it. Please, its been a week and I'm tired searching about it and nothing seems to work at all. I know its too much to ask but if you have the code to implement the back button for custom navigation bar, please post it. I desperately need help.
Thank you
I'm building an mobile application with JQuery Mobile and I found a very big bug..
If I press the back button on the phone it's just like clicking on the back arrow on the browser. I would like to click on the button surrounded by red on this picture:
I want it to when I click it shows the 2 options which are "About" and "Exit". I saw some stuff online about the exit button but couldnt get any to work and I also tried to find something on the jquerymobile docs but no success..
Thanks for your attention!
To listen to those events you will have to use PhoneGap if you are building non native app.
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.
here i want to launch Android Home Screen
Can anybody tell me where to find information about how to write a custom home-screen application? and i want to remove android default home screen. and add my custom home screen code to source of android.
So very first i have to make application which launch as a home screen so any body can give me some tips or guidelines?
Thanks
create a home application , which is nothing but an application with home intent . Samples (../android-sdk-linux/samples/android-8) have a good example named "Home" .
once app install when user will click on homeScreen he will be prompted for select home among existing home apps (including your app too) , once user set it as default this will not be asked again .