Questions tagged [application-lifecycle]

It is usually used in enterprise programming contexts where application, session and request scopes (lifecycles) can be distinguished. In this case specific objects (e.g. an EJB if speaking about Java EE) can have different lifecycles according to these scopes managed by the container infrastructure.

221 questions
201
votes
9 answers

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

I want to check if the app is running in the background. In: locationManagerDidUpdateLocation { if(app is runing in background){ do this } }
174
votes
13 answers

What is Activity.finish() method doing exactly?

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…
Tal Kanel
  • 10,475
  • 10
  • 60
  • 98
113
votes
7 answers

Using the Android Application class to persist data

I'm working on a fairly complex Android application that requires a somewhat large amount of data about the application (I'd say a total of about 500KB -- is this large for a mobile device?). From what I can tell, any orientation change in the…
Dave
  • 2,546
  • 6
  • 23
  • 29
65
votes
3 answers

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

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…
Yasin YILDIRIM
  • 1,540
  • 2
  • 17
  • 29
27
votes
1 answer

What is the proper way to unregister Activity lifecycle callbacks?

In the Android Application class you can register/unregister ActivityLifecycleCallbacks, which allow you to monitor Activity lifecycle events in your application all in one place (if you so desire). Where is the proper place to call…
Christopher Perry
  • 38,891
  • 43
  • 145
  • 187
26
votes
5 answers

Register and Unregister the BroadcastReceiver in Application Class

I have a broadcast receiver Which is registered in the onCreate() method of Android Applcation class but How to unRegister the same example public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); …
Anbu
  • 671
  • 1
  • 6
  • 18
17
votes
4 answers

ProcessLifecycleOwner not working after updating app compat to 1.4.1

I'm investigating a weird issue, where we changed the androidx.appcompat:appcompat from 1.3.1 to 1.4.1 and all of a sudden our LifecycleObservers observing process lifecycle stopped emitting any events. I'm also using…
13
votes
2 answers

iOS 10 UNNotificationAction Open App from Background

How can I open my app, when user receive notification and my app was in background? Of course tap on notification itself would open app, but how to handle it with custom notification action? I have implemented UNUserNotificationCenterDelegate and…
12
votes
1 answer

How to : Debug UIWindows were created prior to initial application activation

My console posted this error today, [ApplicationLifecycle] UIWindows were created prior to initial application activation. This may result in incorrect visual appearance. This has caused Application UI to not behave properly. I have never seen this…
Joshua
  • 481
  • 6
  • 21
9
votes
2 answers

Why is IsCancellationRequested not set to true on stopping a BackgroundService in .NET Core 3.1?

I've read most articles I can find about IHostApplicationLifetime and CancellationToken's in .NET Core 3.1, but I cannot find a reason why this is not working. I have a simple BackgroundService which look like the following: public class…
Jim Aho
  • 9,932
  • 15
  • 56
  • 87
9
votes
1 answer

View controller responds to app delegate notifications in iOS 12 but not in iOS 13

I have an app that supports iOS 12. I am adding support for iOS 13. I have a view controller that needs to perform a quick action when the app goes to the background. Prior to iOS 13 that is simple enough. Add a line such…
rmaddy
  • 314,917
  • 42
  • 532
  • 579
9
votes
1 answer

Which method is called when my activity gets the focus? (after a phone call, back key, home key, etc...)

I have a problem with my app. It has a lot of activities. Two of them have google map views. My A activity has a full MapView and my B activity has a small MapView. OK, when I am on the B activity and press back key sometimes until I return to my A…
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
9
votes
1 answer

How can I check when an app comes back into the foreground from the background, but not from push notification?

func application(application: UIApplication, didReceiveRemoteNotification data: [NSObject : AnyObject]) { var dat = JSON(data) if application.applicationState == UIApplicationState.Active { // app was already in the…
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
8
votes
1 answer

Android: Application onCreate called every time app goes to background

I've a strange behavior with an android app when it runs on a S3 with android 4.3: every time app goes to background (pressing back button), when it's resumed, it calls the onCreate() method of Application class. Reading the Android documentation,…
M-S
  • 617
  • 7
  • 19
1
2 3
14 15