package com.createchance.doorgod.ui;

import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.createchance.doorgod.R;
import com.createchance.doorgod.service.DoorGodService;

public class DoorGodActivity extends AppCompatActivity {

    private static final String TAG = "DoorGodActivity";

    private DoorGodService.ServiceBinder mService;
    private ServiceConnection mConnection = new ServiceConnection() {
        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            mService = (DoorGodService.ServiceBinder) service;
        }

        @Override
        public void onServiceDisconnected(ComponentName name) {
            mService = null;
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_door_god);

        Intent intent = new Intent(DoorGodActivity.this, DoorGodService.class);
        bindService(intent, mConnection, BIND_AUTO_CREATE);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        unbindService(mConnection);
    }

    public DoorGodService.ServiceBinder getService() {
        return mService;
    }
}

@@ -1301,24 +1301,233 @@
 on);%0A    %7D%0A%0A
+    @Override%0A    public void onBackPressed() %7B%0A        super.onBackPressed();%0A%0A        Intent i = new Intent(Intent.ACTION_MAIN);%0A        i.addCategory(Intent.CATEGORY_HOME);%0A        startActivity(i);%0A    %7D%0A%0A
     public D

Handle back button pressed event in DoorGodActivity. When user press back button to cancel auth, we just return to home screen.