Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.hardware.SensorManager; public class Main { /** * @param context * @return boolean * @throws * @Title: isHaveGravity * @Description: TODO */ public static boolean isHaveGravity(Context context) { SensorManager sm = (SensorManager) context.getSystemService(context.SENSOR_SERVICE); if (sm == null) return false; return true; } }