Android: Add confirmation before exit

Created on 4 Mar 2018  路  15Comments  路  Source: nextcloud/android

Actual behaviour

Currently the app closes if the user hits the back button.

Expected behaviour

The user should be prompted for exit if s/he hits the back button because the user might happen to hit the back button by chance which leads to an unintended exit form the app.
A toast could be displayed, say "Press again to exit', so as to avoid unintended exit from the app.

Steps to reproduce

  1. Open the app or log into you account
  2. Press the back button
  3. The app closes in a single hit of back button

Environment data

Android version: 7.0

Device model: Xiaomi Redmi Note 4

enhancement pr exists

Most helpful comment

@jancborchardt Thanks for adding me to the Nextcloud organization. :)

All 15 comments

As I am new to this community, could anybody please let me know if I want to work on an issue what am I supposed to do i.e. wait for approval of the project maintainers/mentors or should I directly send a PR for this issue. It would be really helpful if somebody could help me get started here. :slightly_smiling_face:

Ah, this is not a bad thing. I guess you can work on this, yes :)

@mario Thanks.. Would soon send a PR. :smiley:

Sorry, only saw this now, as @tobiasKaminsky made me aware of it. He mentioned this might be an anti-pattern: https://www.androiddesignpatterns.com/2012/08/exit-application-dialogs-are-evil-dont.html

And I agree. Other established apps like Gmail and Netflix (etc) do not do this as it hijacks user input. @AndyScherzinger @mario or is this some kind of Android standard I鈥檓 not aware of?

Well to be perfectly honest we don't show a dialog. Just a warning that if you click once more you'll exit.

For example, I remember that at one point in time you needed something like this if you wanted to be listed in the Samsung App store.

Dunno. Don't have a strong opinion on this.

That鈥檚 the thing though: Every other app just exits directly. Hence we interrupt people鈥檚 flow and expectation. Design-wise, we should not have this (sorry @arundhati24 :)

If there鈥檚 indeed specific environments like Samsung which require this, we should have a conditional only for them, and only if it鈥檚 absolutely required. But not break everyone鈥檚 experience.

We're not in the Samsung store though :P

Fine with removing if that's your wish here. :) cc @AndyScherzinger thoughts?

@jancborchardt I checked some of the standard apps. I agree that most of the standard apps do not follow this. But, it would be great if you could reflect a bit on how it hijacks user input. :)
If that's the case, I would like to know about it because there are other projects that I have been working on and they use this. I tried to read about it but couldn't find such a case.

In case this is a security breach I would like to check all the other projects that I have been working on as well for this.

@arundhati24 sure, some clarification :)

  • I mean hijacking in the sense that it breaks the user expectation. It鈥檚 not a security breach. :)
  • Normally the back button in this case is exactly for that: Exiting the app. When you just opened the app but it was the wrong one, you want to be able to use the back button to get out.
  • Popular apps like Netflix, Dropbox, Google Mail etc etc do not have this confirmation but just close on back button press.
  • Exiting the app usually does not result in any lost data, so no confirmation is needed.

And sorry that I only saw this now, normally we always have design discussions before we have the pull request, and that would have been caught. We are very welcoming to contributors and in this case we should have discussed it a bit more. :) Sorry

It's okay @jancborchardt :) Thanks for the clarification. I learnt something from this - a NOT TO DO. :D
And yes I checked that most of the standard apps from Google too don't use this. I am sorry. :)
But I would love to discuss on other issues too with you all and I hope it would be a great place for me to learn. :)

@arundhati24 yup! :) Also just added you to the Nextcloud organization, so welcome again!

@jancborchardt Maybe we can improve the UX with an option in the settings ;) Just as suggestion ;)

@jancborchardt Thanks for adding me to the Nextcloud organization. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobiasKaminsky picture tobiasKaminsky  路  3Comments

tobiasKaminsky picture tobiasKaminsky  路  3Comments

tobiasKaminsky picture tobiasKaminsky  路  3Comments

toobie83 picture toobie83  路  3Comments

daywalk3r666 picture daywalk3r666  路  3Comments