package com.tk20.tk20android;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.support.wearable.activity.WearableActivity;
import android.support.wearable.view.BoxInsetLayout;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class MainActivity extends WearableActivity {

  private static final SimpleDateFormat AMBIENT_DATE_FORMAT =
      new SimpleDateFormat("HH:mm", Locale.US);

  private BoxInsetLayout mContainerView;
  private TextView mTextView;
  private TextView mClockView;

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

    mContainerView = (BoxInsetLayout) findViewById(R.id.container);
    mTextView = (TextView) findViewById(R.id.text);
    mClockView = (TextView) findViewById(R.id.clock);

    SensorManager manager = (SensorManager)getSystemService(SENSOR_SERVICE);
    Sensor hSensor = manager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
    manager.registerListener(new SensorEventListener() {
      @Override
      public void onSensorChanged(SensorEvent event) {
        mTextView.setText("" + event.values[0]);
      }

      @Override
      public void onAccuracyChanged(Sensor sensor, int accuracy) {

      }
    },hSensor,SensorManager.SENSOR_DELAY_NORMAL);
  }

  @Override
  public void onEnterAmbient(Bundle ambientDetails) {
    super.onEnterAmbient(ambientDetails);
    updateDisplay();
  }

  @Override
  public void onUpdateAmbient() {
    super.onUpdateAmbient();
    updateDisplay();
  }

  @Override
  public void onExitAmbient() {
    updateDisplay();
    super.onExitAmbient();
  }

  private void updateDisplay() {
    if (isAmbient()) {
      mContainerView.setBackgroundColor(getResources().getColor(android.R.color.black));
      mTextView.setTextColor(getResources().getColor(android.R.color.white));
      mClockView.setVisibility(View.VISIBLE);

      mClockView.setText(AMBIENT_DATE_FORMAT.format(new Date()));
    } else {
      mContainerView.setBackground(null);
      mTextView.setTextColor(getResources().getColor(android.R.color.black));
      mClockView.setVisibility(View.GONE);
    }
  }
}

package com.tk20.tk20android;

import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.support.wearable.activity.WearableActivity;
import android.support.wearable.view.BoxInsetLayout;
import android.view.View;
import android.widget.TextView;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class MainActivity extends WearableActivity {

  private static final SimpleDateFormat AMBIENT_DATE_FORMAT =
      new SimpleDateFormat("HH:mm", Locale.US);

  private BoxInsetLayout mContainerView;
  private TextView mTextView;
  private TextView mClockView;

  private SensorEventListener mListener = null;

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

    mContainerView = (BoxInsetLayout) findViewById(R.id.container);
    mTextView = (TextView) findViewById(R.id.text);
    mClockView = (TextView) findViewById(R.id.clock);

    SensorManager manager = (SensorManager)getSystemService(SENSOR_SERVICE);
    Sensor hSensor = manager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
    mListener = new SensorEventListener() {
      @Override
      public void onSensorChanged(SensorEvent event) {
        mTextView.setText("" + event.values[0]);
        // Send notification in emergency case.
        // Wearable.MessageApi.sendMessage(...

      }

      @Override
      public void onAccuracyChanged(Sensor sensor, int accuracy) {

      }
    };
    manager.registerListener(mListener, hSensor, SensorManager.SENSOR_DELAY_NORMAL);
  }

  @Override
  public void onEnterAmbient(Bundle ambientDetails) {
    super.onEnterAmbient(ambientDetails);
    updateDisplay();
  }

  @Override
  public void onUpdateAmbient() {
    super.onUpdateAmbient();
    updateDisplay();
  }

  @Override
  public void onExitAmbient() {
    updateDisplay();
    super.onExitAmbient();
  }

  private void updateDisplay() {
    if (isAmbient()) {
      mContainerView.setBackgroundColor(getResources().getColor(android.R.color.black));
      mTextView.setTextColor(getResources().getColor(android.R.color.white));
      mClockView.setVisibility(View.VISIBLE);

      mClockView.setText(AMBIENT_DATE_FORMAT.format(new Date()));
    } else {
      mContainerView.setBackground(null);
      mTextView.setTextColor(getResources().getColor(android.R.color.black));
      mClockView.setVisibility(View.GONE);
    }
  }

  @Override
  protected void onPause() {
    super.onPause();
    finish();
  }

  @Override
  protected void onDestroy() {
    ((SensorManager)getSystemService(SENSOR_SERVICE)).unregisterListener(mListener);
    super.onDestroy();
  }
}

Add function to get heart rate