package com.tcl.ah.tvcontrol;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import com.tcl.ah.tvcontrol.service.MyMqttService;
import com.tcl.ah.tvcontrol.service.ServiceHelper;

public class MainActivity extends AppCompatActivity {

    public static String TAG = "DEBUG_TS";
    Handler mHandler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i("DEBUG_TS", "this is onCreate");
        setContentView(R.layout.activity_main);

        //todo test
        //myTest();

    }

    private void myTest() {
        startMqttService();
//        mHandler = new Handler();
//        mHandler.postDelayed(new Runnable() {
//            @Override
//            public void run() {
//                String packageName = "";//com.morequick.player
////        String packageName = "com.tcl.vod";
//                PackageHelper.startActivityByPackage(packageName);
//            }
//        }, 2000);
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onResume() {

        Log.i("DEBUG_TS", "this is onResume");
        super.onResume();
    }

    public void startMqttService() {

        Intent mMqttIntent = new Intent(MyApplication.getAppContext(), MyMqttService.class);
        ServiceHelper.startService(MyApplication.getAppContext(), mMqttIntent);

    }


}