Java tutorial
//package com.java2s; import android.content.Context; import android.content.pm.PackageManager; public class Main { public static boolean isDeviceCompatible(Context context) { return context.getPackageManager() != null && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER) && context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS); } }