package com.quanming.dianjing

import android.content.Intent
import android.os.Bundle

import io.flutter.app.FlutterActivity
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity : FlutterActivity() {
    val APP_LIFECYCLE_ACTION = "APP_LIFECYCLE_ACTION"

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        GeneratedPluginRegistrant.registerWith(this)
    }

    override fun onResume() {
        super.onResume()
        val intent = Intent()
        intent.action = APP_LIFECYCLE_ACTION
        intent.putExtra("event", "onResume")
        sendBroadcast(intent)
    }

    override fun onPause() {
        super.onPause()
        val intent = Intent()
        intent.action = APP_LIFECYCLE_ACTION
        intent.putExtra("event", "onPause")
        sendBroadcast(intent)
    }
}
