List of usage examples for android.content Context getSystemService
@SuppressWarnings("unchecked") public final @Nullable <T> T getSystemService(@NonNull Class<T> serviceClass)
From source file:Main.java
public static void vibrate(Context context, long timeMs) { ((Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE)).vibrate(timeMs); }
From source file:Main.java
public static WindowManager getWindowManager(Context paramContext) { return (WindowManager) paramContext.getSystemService(Context.WINDOW_SERVICE); }
From source file:Main.java
public static void useContext(Context context) { manager = (UsbManager) context.getSystemService(Service.USB_SERVICE); }
From source file:Main.java
public static LayoutInflater getLayoutInflater(Context c) { return (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); }
From source file:Main.java
private static String getImei(Context context) { return ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); }
From source file:Main.java
@SuppressWarnings("unchecked") static <T> T getService(Context context, String service) { return (T) context.getSystemService(service); }
From source file:Main.java
public static boolean isWifiConnect(Context context) { return ((ConnectivityManager) context.getSystemService("connectivity")).getNetworkInfo(1).isConnected(); }
From source file:Main.java
public static void playKeyPress(Context c) { AudioManager am = (AudioManager) c.getSystemService(Context.AUDIO_SERVICE); am.playSoundEffect(AudioManager.FX_KEY_CLICK, (float) 0.25); }
From source file:Main.java
public static WifiManager getWifiManager(final Context pContext) { return (WifiManager) pContext.getSystemService(Context.WIFI_SERVICE); }
From source file:Main.java
public static String getDeviceId(Context context) { return ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); }