Back to project page CopresenceDataCollector.
The source code is released under:
Copyright (c) 2014, Xiang Gao All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Re...
If you think the Android project CopresenceDataCollector listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.sesy.coco.datacollector; /*from w ww .jav a 2 s . c om*/ import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.net.wifi.WifiManager; import android.provider.Settings; import android.telephony.TelephonyManager; public class PluginManager { private Context _context; //private BluetoothAdapter mBluetoothAdapter = null; //private WifiManager mainWifi = null; //Logger log; public PluginManager(Context context){ this._context = context; /*log = Logger.getLogger(PluginManager.class); ConfigureLog4J.configure(context); LogManager.getRootLogger().setLevel((Level)Level.DEBUG); */ //log.info("log configured."); } public boolean isGPSOn(){ String provider = Settings.Secure.getString(_context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); return provider.contains("gps"); } public boolean isBTOn(){ BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); return mBluetoothAdapter.isEnabled(); } public boolean isWifiOn(){ WifiManager mainWifi = (WifiManager) _context.getSystemService(Context.WIFI_SERVICE); return mainWifi.isWifiEnabled(); } public boolean isCellAvailable() { TelephonyManager tel = (TelephonyManager) _context.getSystemService(Context.TELEPHONY_SERVICE); if(tel.getNetworkOperator() == null || tel.getSimState() != TelephonyManager.SIM_STATE_READY) return false; else if(tel.getNetworkOperator().equals("")) return false; else return true; } }