Skip to content

Improve handling moving the app to background  #2844

@DenBond7

Description

@DenBond7

Need to improve handling moving the app to background. It will improve showing notifications about new messages.

class AppForegroundedObserver : DefaultLifecycleObserver {
    val isAppForegrounded: Boolean
      get() {
        return isAppForegroundedInternal
      }
    private var isAppForegroundedInternal = false
    override fun onStart(owner: LifecycleOwner) {
      isAppForegroundedInternal = false
    }

    override fun onStop(owner: LifecycleOwner) {
      isAppForegroundedInternal = true
    }
  }
class FlowCryptApplication : Application(), Configuration.Provider {

  val appForegroundedObserver = AppForegroundedObserver()

  .........

  override fun onCreate() {
    super.onCreate()
    ProcessLifecycleOwner.get().lifecycle.addObserver(appForegroundedObserver)
..........

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions