package
com.cy.tools;
import
android.annotation.suppresslint;
import
import
android.bluetooth.bluetoothadapter;
import
android.content.context;
import
android.content.intent;
import
android.content.pm.packagemanager;
import
android.hardware.camera;
import
android.hardware.camera.camerainfo;
import
android.hardware.camera.parameters;
import
android.hardware.sensor;
import
android.hardware.sensorevent;
import
android.hardware.sensoreventlistener;
import
android.hardware.sensormanager;
import
android.location.criteria;
import
android.location.locationmanager;
import
android.media.audiomanager;
import
android.media.mediarecorder;
import
android.net.wifi.wifimanager;
import
android.os.build.version;
import
android.os.handler;
import
android.os.vibrator;
import
android.widget.toast;
@suppresslint
()
public
class
checkutils
catch
(interruptedexception localinterruptedexception)
return
false
; }
/** 開啟揚聲器 */
public
static
boolean
openspeaker(context paramcontext)
return
true
; }
catch
(exception localexception)
return
false
; }
/** 檢測藍芽 */
public
static
boolean
bluetoothisgood()
boolean
bool1 = localbluetoothadapter.disable();
localbluetoothadapter.enable();
return
bool1;
} /** 檢測相機 */
private
static
boolean
checkcamerafacing(
intparamint)
} } /** 檢測定位 */
public
static
boolean
getlocation(context paramcontext)
/** 獲取sdk版本 */
public
static
intgetsdkversion()
/** 檢測後置相機 */
public
static
boolean
hasbackfacingcamera()
/** 檢測前置相機 */
public
static
boolean
hasfrontfacingcamera()
/** 檢測加速器 */
public
static
void
isaccelerometer(context paramcontext, handler paramhandler)
localsensormanager.registerlistener(new
sensoreventlistener(paramhandler)
public
void
onsensorchanged(sensorevent paramsensorevent)
} , localsensor, 3
);
} /** 檢測磁感 */
public
static
void
isciligood(context paramcontext, handler paramhandler)
localsensormanager.registerlistener(new
sensoreventlistener(paramhandler)
public
void
onsensorchanged(sensorevent paramsensorevent)
} , localsensor, 3
);
} /** 檢測陀螺儀 */
public
static
void
isgyroscopegood(context paramcontext, handler paramhandler)
localsensormanager.registerlistener(new
sensoreventlistener(paramhandler)
public
void
onsensorchanged(sensorevent paramsensorevent)
} , localsensor, 3
);
} /** 檢測揚聲器 */
public
static
boolean
isspeakergood(context paramcontext)
/** 檢測振動器 */
public
static
boolean
isvibratorgood(context paramcontext)
, -1
);
return
localvibrator.hasvibrator();
} /** 檢測麥克風 */
public
static
boolean
ismicrophonegood(context paramcontext)
/** 開啟gps */
public
static
void
opengpssettings(activity paramactivity)
toast.maketext(paramactivity, "請開啟gps!", 0
).show();
paramactivity.startactivityforresult(new
intent(
"android.settings.security_settings"
), 0
);
} /** 檢測聽筒 */
public
static
boolean
istelephonegood(context paramcontext)
/** 檢測wifi */
public
static
boolean
iswifiisgood(context paramcontext)
boolean
bool1 = localwifimanager.setwifienabled(
false
);
localwifimanager.setwifienabled(true
);
return
bool1;
} /** 關閉揚聲器 */
public
void
closespeaker(context paramcontext)
return
; }
catch
(exception localexception)
} }
Android獲取手機狀態和監聽手機來電狀態
獲取手機狀態 import android.content.context import android.telephony.telephonymanager 獲得相應的系統服務 telephonymanager tm telephonymanager getsystemservice contex...
Android 檢測網路連線狀態
檢測是否接入網際網路 connectivitymanager cm connectivitymanager context.getsystemservice context.connectivity service networkinfo activenetwork cm.getactivenetw...
關於android 手機硬體加速問題
分類 android基礎 2012 04 12 14 44 740人閱讀收藏 舉報硬體加速的官方文件 開啟硬體加速有兩種大的途徑 1.在系統設定 開發人員 中勾選啟用gpu加速 2.在應用程式中啟用硬體加速 目前遇到的問題有,啟用硬體加速後,webview的效能受到一定影響,設定背景透明無效。目前4...