1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

About Android...

Discussion in 'Programming' started by xtmx, Apr 29, 2013.

  1. #1
    Today I was working on my Android game, when I wanted to create the ability for my WebView to exit the app and clear it from memory. I looked up how to do so, and I ended up finding people saying that Android doesn't support this, people saying that it's better if people understand how Android is meant to work, blah blah blah. I remembered from a previous app I developed that "finish()" leaves the app in memory. I tried using System.exit(0), but it just reset the app.

    I eventually found out how to get it working (closing the app completely, freeing all of its memory rather than backgrounding it like most tech pundits recommend). Although I got it working, I have questions...

    Why don't Google and other sites better document this feature? Is there really something wrong with freeing the memory of the application when the user chooses to close it?
    xtmx, Apr 29, 2013 IP
  2. scriptjerk

    scriptjerk Member

    Messages:
    34
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    33
    #2
    It is my understanding that the main reason why to not do this is so user can access the app faster next time, and it makes sense a little, since the user can exit from outside the app if really needed and using apps designed for this makes it kinda easy. The option should be a user setting tho like how dolphin browser is, where when you back out, it will ask if you want to close or minimize. Im not too far into android development to really know best practices tho, but i know as a user, i like options, and closing out an app to free memory should be a standard option for all apps.
    scriptjerk, Apr 29, 2013 IP
  3. BlastPort

    BlastPort Greenhorn

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #3
    Sorry I know this thread is a month old or so, but just wanted to chime in that this is highly discouraged for not only Android apps, but iOS as well. In fact, iOS apps will be denied by Apple if you utilize their system-exit routine, as they have marked is as a "private API" not to be used for a released app.

    There are several reasons for this, but primarily the standard has become that the device's system should control whether an app should be "closed" and wiped from memory (typically only if system resources require it to be), and users should control when and if they want to exit an application - using the home button on an iOS device and the back/home button on an Android. This has just become a standard to keep things more simple and controlled, so it's something we developers need to stick to.

    That being said, I've been frustrated by this in the past as well. For instance, we have a few apps in which we added password-protection, so we needed to exit the app if the user inputs the incorrect password upon startup of the app. When the rule came out from Apple that we could no longer just "exit" the app, we had to re-think this and modify the UX a bit, even though the solution we came up with wasn't as good as when it simply exited the app.
    BlastPort, Jul 14, 2013 IP