application-lifecycle

Determine if application on foreground - is that frowned upon?

青春壹個敷衍的年華 提交于 2019-11-30 15:47:40
There are lots of reasons why detecting if application is on foreground. for example - as a trigger to GCM/C2DM push notification - lot's of apps would have good reason implementing different behavior when app is foreground and background. Other reason could be - shotting down services consuming precious resources, such as querying servers in background task for instance. Just to be clear: the definition (as I see it) for background app is : application which none of it activities are invoked the onStart() method, and did not invoke yet the onStop() method. that's because activity is visible

exit entire app at once

梦想的初衷 提交于 2019-11-30 15:39:37
I have used the code from here in my app, when I click on 'Cancel' option ,the app just minimizes ,when I long press and hold Home button and select the app.It shows the same screen not the splashscreen or the usual way the app starts - So I am assuming it just takes me to home screen. I am looking for a way I can close the main activity completely. I have tried the following methods and it crashed every time: finish(); mainactivity.class.finish(); opening an intent which has systemexit() setresult() in the another activity. Not recommened but still you can use this. Better go with this

Application_Start ASP.NET

吃可爱长大的小学妹 提交于 2019-11-30 09:32:51
If get this from the Microsoft official documentation : The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance. I was sure that Application_Start was related to the HttpApplication, here this guy explains why I was wrong. Which object/entity is related to the Application_Start event? As the documentation says, the events are linked to the lifetime of the application domain , which in practice means the app pool which the

Application_Start ASP.NET

浪子不回头ぞ 提交于 2019-11-29 14:38:47
问题 If get this from the Microsoft official documentation: The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance. I was sure that Application_Start was related to the HttpApplication, here this guy explains why I was wrong. Which object/entity is related to the Application_Start event? 回答1: As the documentation says, the events are

When does Application's onCreate() method get called?

泪湿孤枕 提交于 2019-11-27 18:56:45
In my Android application, I have a DefaultApplication class which extends android.app.Application , and in its onCreate() I bind some services which will be used by my other Activities in this app. Also I have a BroadcastReceiver which listens and receives C2DM Messages. When this receiver receives a message when the application is not running, it will fire a dialog which shows the upcoming message and it will start an Activity of my application. My question is, when I start an activity without any interaction with DefaultApplication , will my DefaultApplication 's onCreate() get called

Is there any way to check if iOS app is in background?

随声附和 提交于 2019-11-27 17:28:25
I want to check if the app is running in the background. In: locationManagerDidUpdateLocation { if(app is runing in background){ do this } } DavidN App delegate gets callbacks indicating state transitions. You can track it based on that. Also the applicationState property in UIApplication returns the current state. [[UIApplication sharedApplication] applicationState] Aswathy Bose UIApplicationState state = [[UIApplication sharedApplication] applicationState]; if (state == UIApplicationStateBackground || state == UIApplicationStateInactive) { //Do checking here. } This may help you in solving

When does Application's onCreate() method get called?

前提是你 提交于 2019-11-26 19:41:04
问题 In my Android application, I have a DefaultApplication class which extends android.app.Application , and in its onCreate() I bind some services which will be used by my other Activities in this app. Also I have a BroadcastReceiver which listens and receives C2DM Messages. When this receiver receives a message when the application is not running, it will fire a dialog which shows the upcoming message and it will start an Activity of my application. My question is, when I start an activity

Is there any way to check if iOS app is in background?

眉间皱痕 提交于 2019-11-26 18:59:54
问题 I want to check if the app is running in the background. In: locationManagerDidUpdateLocation { if(app is runing in background){ do this } } 回答1: App delegate gets callbacks indicating state transitions. You can track it based on that. Also the applicationState property in UIApplication returns the current state. [[UIApplication sharedApplication] applicationState] 回答2: UIApplicationState state = [[UIApplication sharedApplication] applicationState]; if (state == UIApplicationStateBackground |

applicationWillTerminate: not being called

核能气质少年 提交于 2019-11-26 17:17:15
问题 I'm using applicationWillTerminate: to save some last-minute stuff. But the problem is that it never gets called. If I do something like this at the top of the method: NSLog(@"Something"); it doesn't get called and doesn't get outputted to the console. Does anyone know why this is happening? 回答1: From Apple docs: For applications that do not support background execution or are linked against iOS 3.x or earlier, this method is always called when the user quits the application. For applications

what exactly Activity.finish() method is doing?

☆樱花仙子☆ 提交于 2019-11-26 00:23:39
问题 I\'m developing android applications for a while, and followed a lot of posts about activity life cycle, and application\'s life cycle. I know Activity.finish() method calls somewhere in the way to Activity.onDestroy() , and also removing the activity from stack, and I guess it somehow points to operating system and garbage collector that he can \"do his trick\" and free the memory when it find it a good time doing so.... I came to this post - Is quitting an application frowned upon? and read