Q: Google fit add activity programmatically Is possible to add a simple activity for example biking with time distance and calories from my Android application? I can connect to my Google fit account but don't know how to add a simple activity like biking. 

A: Yes it is here is the code that work for me .. check this out 
private SessionInsertRequest insertFitnessSession(ExerciseBean bean) {
    /*
     * Distance Data source
     */
    DataSource distance = new DataSource.Builder()
            .setAppPackageName("com.package")
            .setDataType(DataType.TYPE_DISTANCE_DELTA)
            .setType(DataSource.TYPE_RAW).build();
    DataSet distanceDataSet = DataSet.create(distance);
    DataPoint distanceDataPoint = DataPoint.create(distance)
            .setTimeInterval(bean.getStartTime(), bean.getEndTime(), TimeUnit.MILLISECONDS);
    distanceDataPoint.getValue(Field.FIELD_DISTANCE).setFloat((float)bean.getEx_distance());
    distanceDataSet.add(distanceDataPoint);

    /*
     * Steps Data source
     */
    DataSource steps = new DataSource.Builder()
            .setAppPackageName("com.package")
            .setDataType(DataType.TYPE_STEP_COUNT_DELTA)
            .setType(DataSource.TYPE_RAW).build();
    DataSet stepsDataSet = DataSet.create(steps);
    DataPoint stepsDataPoint = DataPoint.create(steps).setTimeInterval(
            bean.getStartTime(), bean.getEndTime(), TimeUnit.MILLISECONDS);
    stepsDataPoint.getValue(Field.FIELD_STEPS).setInt(bean.getSteps());
    stepsDataSet.add(stepsDataPoint);

    /*
     * Calory Data source
     */
    DataSource calory = new DataSource.Builder()
            .setAppPackageName("com.package")
            .setDataType(DataType.TYPE_CALORIES_EXPENDED)
            .setType(DataSource.TYPE_RAW).build();
    DataSet calDataSet = DataSet.create(calory);
    DataPoint calDataPoint = DataPoint.create(calory).setTimeInterval(
            bean.getStartTime(), bean.getEndTime(), TimeUnit.MILLISECONDS);
    calDataPoint.getValue(Field.FIELD_CALORIES).setFloat((float)bean.getEx_calories());
    calDataSet.add(calDataPoint);

    /*
     * Activity data source
     */
    DataSource acSource = new DataSource.Builder()
            .setAppPackageName("com.package")
            .setDataType(DataType.TYPE_ACTIVITY_SEGMENT)
            .setType(DataSource.TYPE_DERIVED).build();
    DataSet dataSet = DataSet.create(acSource);
    DataPoint dataPoint = DataPoint.create(acSource).setTimeInterval(bean.getStartTime(),bean.getEndTime(), TimeUnit.MILLISECONDS);
    dataPoint.getValue(Field.FIELD_ACTIVITY).setActivity(FitnessActivities.BASKETBALL);
    //dataPoint.getValue(Field.FIELD_DURATION).setInt(103434);// In milisecond
    dataSet.add(dataPoint);

    /*
     * DataSource acSource = new DataSource.Builder()
     * .setAppPackageName("com.package")
     * .setDataType(DataType.AGGREGATE_ACTIVITY_SUMMARY)
     * .setType(DataSource.TYPE_DERIVED).build(); DataSet dataSet =
     * DataSet.create(acSource); DataPoint dataPoint =
     * DataPoint.create(acSource).setTimeInterval(startTime, endTime,
     * TimeUnit.MILLISECONDS);
     * dataPoint.getValue(Field.FIELD_ACTIVITY).setActivity
     * (FitnessActivities.CRICKET);
     * dataPoint.getValue(Field.FIELD_DURATION).setInt(103434);// In
     * milisecond dataSet.add(dataPoint);
     */
    Session session = new Session.Builder().setName("SAMPLE_SESSION_NAME")
            .setDescription("activity description")
            .setIdentifier("UniqueIdentifierHere")
            .setActivity(FitnessActivities.CRICKET)
            .setStartTime(bean.getStartTime(), TimeUnit.MILLISECONDS)
            .setEndTime(bean.getEndTime(), TimeUnit.MILLISECONDS)
            .build();

    // Build a session insert request
    SessionInsertRequest insertRequest = new SessionInsertRequest.Builder()
        .setSession(session)
            .addDataSet(dataSet).addDataSet(calDataSet)
            .addDataSet(stepsDataSet).addDataSet(distanceDataSet).build();
    return insertRequest;
}

And then just insert it . If you dont need distance ,calories and steps the you can skip the dataset of these 
SessionInsertRequest insertRequest = insertFitnessSession(bean);
    com.google.android.gms.common.api.Status insertStatus = Fitness.SessionsApi
            .insertSession(fitnessClient, insertRequest).await(1,
                    TimeUnit.MINUTES);
    if (insertStatus.isSuccess()) {
        Log.e("Activity", "Inserted");
    } else {
        Log.e("Activity", "inserted failed");
    }


A: I think you have to work with the Fittnes History. 
Here you have a full example:
Example. Other examples you can find here
