首先AndroidMainfast.xml文件中添加权限:
然后再activity中添加如下代码:
private String getConnectWifiSsid(){
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
WifiInfo wifiInfo =...
分类:
移动开发 时间:
2014-08-13 19:04:17
阅读次数:
270
@Override public boolean onTouchEvent(MotionEvent event) { InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_...
分类:
其他好文 时间:
2014-08-12 18:39:34
阅读次数:
184
Android开发平台中,可通过TelephonyManager 获取本机号码。
TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
txtPhoneNumber.setText(phoneMgr.getLine1Number()); //txtPhoneNu...
分类:
移动开发 时间:
2014-08-09 15:56:38
阅读次数:
267
带有g-sensor的Android设备上可通过API获取到设备的运动加速度,应用程序通过一些假设和运算,可以从加速度计算出设备的方向获取设备运动加速度的基本代码是: SensorManager sm = (SensorManager) context.getSystemService...
分类:
移动开发 时间:
2014-08-06 22:07:02
阅读次数:
349
private String getPhoneNum(){ //与手机建立连接 TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); String phoneId =...
分类:
移动开发 时间:
2014-08-06 18:03:11
阅读次数:
316
Android提供了GPS功能LocationManager obj = (LocationManager)getSystemService(Context.LOCATION_SERVICE)Permission基本上是使用百度地图定位
分类:
移动开发 时间:
2014-08-06 14:41:11
阅读次数:
211
1 /**2 * 3 */4 private boolean isHome() {5 ActivityManager mActivityManager = (ActivityManager) getSystemService(Context.ACTIVIT...
分类:
移动开发 时间:
2014-08-05 11:02:49
阅读次数:
246
[html] view plaincopyTelephonyManagertelManager=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);telManager.getSimCountryIso();SIM卡的序列号[h...
分类:
移动开发 时间:
2014-08-04 14:13:27
阅读次数:
1042
核心代码:Imei = ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)).getDeviceId();1.加入权限在manifest.xml文件中要添加 2.代码/*****创建日期2010-4-29下午05:02:47**/packa...
分类:
移动开发 时间:
2014-08-04 14:13:07
阅读次数:
284
这样来写:
public void onCreate() {
super.onCreate();
ntfmngr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
setNotifyType(R.drawable.logo,"aaaaaaaaaaa",3);
}
private void setN...
分类:
移动开发 时间:
2014-08-02 07:42:43
阅读次数:
218