예제 #1
0
        public override IBinder OnBind(Intent intent)
        {
            Log.Debug(TAG, "OnBind");

            Binder = new ForegroundServiceBinder(this);
            return(Binder);
        }
        public ForegroundServiceConnection(ServicesActivity activity)
        {
            Log.Debug(TAG, "~ constructor");

            IsConnected = false;
            Binder      = null;
            myActivity  = activity;
        }
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            Log.Debug(TAG, $"OnServiceConnected {name.ClassName}");

            ForegroundServiceBinder serviceBinder = service as ForegroundServiceBinder;

            serviceBinder.myActivity = myActivity;
            Binder      = serviceBinder;
            IsConnected = Binder != null;
        }
        public void OnServiceDisconnected(ComponentName name)
        {
            string msg = $"OnServiceDisconnected {name.ClassName}";

            Log.Error(TAG, msg);
            logsDB.AddLogRow(Model.LogStatusesEnum.Warn, msg, TAG);

            IsConnected = false;
            Binder      = null;
            myActivity.UpdateUiForStopService();
        }