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 final void audioModeNormal(Context ctx) { AudioManager audio = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL); }
From source file:Main.java
public static final void audioVolumeRaise(Context ctx) { AudioManager audio = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); audio.adjustVolume(AudioManager.ADJUST_RAISE, 0); }
From source file:Main.java
@SuppressWarnings("unchecked") public static <T> T getSystemService(Context context, String name, T... type) { return (T) context.getSystemService(name); }
From source file:Main.java
public static int getScreeWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); return wm.getDefaultDisplay().getWidth(); }
From source file:Main.java
public static String getDeviceID(Context context) { return ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); }
From source file:Main.java
public static String getDeviceId(Context context) { String IMEI = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getDeviceId(); return IMEI;/*from w w w . j a v a 2s. co m*/ }
From source file:Main.java
public static String getICCID(Context context) { String ret = ((TelephonyManager) context.getSystemService("phone")).getSimSerialNumber(); return ret;//from w w w . j a v a 2s .c o m }
From source file:Main.java
public static int getRingerMode(Context mContext) { AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); return am.getRingerMode(); }
From source file:Main.java
public static String getMac(Context context) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); WifiInfo info = wifi.getConnectionInfo(); return info.getMacAddress(); }
From source file:Main.java
static String getMacAddress(Context context) { WifiManager wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); String m_szWLANMAC = wm.getConnectionInfo().getMacAddress(); return m_szWLANMAC; }