Where to put main code in Mplab Harmony Framework?
I understand that Harmony is supposed to make things simpler. It does this well for configuration -- but it does makes a lot more things confusing especially for newcomers. Your main code can go absolutely anywhere you want and you can just dump the APP_Tasks() function. 

HOWEVER --- if you really want to follow the correct Harmony procedure and not kill any Harmony peripherals or "system services", your main code MUST be non blocking finite state machine and must be in APP_Tasks. 

You should create the states you require for your application state in APP_STATES enum. 

Harmony gives you two states right off the bat that you can use if you want. 

The first state is APP_STATE_INIT, you can put things in this switch case for starting your application code. 

The last state and only second state it gives you is APP_STATE_SERVICE_TASKS which you put your main running code. 

However you should really make your own new states, as your main program probably won't be that simple. For example, this code will go into three states, INIT, AWAIT_ON, AWAIT_OFF. Basically just flipping states based on button presses.

app.h

typedef enum
{
    /* Application's state machine's initial state. */
    APP_STATE_INIT=0,
    APP_STATE_AWAIT_PRESS_ON, // Wait for the on button
    APP_STATE_AWAIT_PRESS_OFF, // Switch off! (back to await press on)

    /* TODO: Define states used by the application state machine. */

} APP_STATES;


App_Tasks()

/* Check the application's current state. */
switch ( appData.state )
{
    /* Application's initial state. */
    case APP_STATE_INIT:
    {
        bool appInitialized = true;

        if (appInitialized)
        {
            // initial LATG state
            LATGbits.LATG0 = 0;

            appData.state = APP_STATE_AWAIT_PRESS_ON;
        }
        break;
    }

    case APP_STATE_AWAIT_PRESS_ON:
    {
        if ( PORTEbits.PORTE0 )
        {
            LATGbits.LATG0 = 1;
            appData.state = APP_STATE_AWAIT_PRESS_OFF;
        }
        break;
    }
    case APP_STATE_AWAIT_PRESS_OFF:
    {
        if ( !PORTEbits.PORTE0 )
        {
            LATGbits.LATG0 = 0;
            appData.state = APP_STATE_AWAIT_PRESS_ON;
        }
        break;
    }

    /* The default state should never be executed. */
    default:
    {
        /* TODO: Handle error in application's state machine. */
        break;
    }
}


There is "heartbeat indicator" example code in MPLAB Harmony Tutorial (Step 7: Develop the Application). I would suggest reading these tutorials before jumping straight in.