当前位置: 首页 > news >正文

南昌科技网站建设哈尔滨网站建设制作费用

南昌科技网站建设,哈尔滨网站建设制作费用,南京网站制作公司有哪些,深圳制作网站的公司简介客户要在app中自由切换动态#xff0c;静态方法#xff0c;直接把系统jar-api给他搞了半天搞不定#xff0c;只有在系统里给他实现一个接口#xff0c;方法如下#xff1a; Index: packages/apps/Settings/AndroidManifest.xml--- packages/apps/Settings/AndroidManifes…客户要在app中自由切换动态静态方法直接把系统jar-api给他搞了半天搞不定只有在系统里给他实现一个接口方法如下 Index: packages/apps/Settings/AndroidManifest.xml--- packages/apps/Settings/AndroidManifest.xml (revision 868)packages/apps/Settings/AndroidManifest.xml (revision 869)-5,7 5,7 android:sharedUserIdandroid.uid.systemoriginal-package android:namecom.android.settings / -uses-permission android:nameandroid.net.action.ETHERNET_IP_CHANGED/uses-permission android:nameandroid.permission.REQUEST_NETWORK_SCORES /uses-permission android:nameandroid.permission.WRITE_MEDIA_STORAGE /uses-permission android:nameandroid.permission.MANAGE_EXTERNAL_STORAGE /-3504,6 3504,14 /intent-filter//receiver receiver android:name.ethernet.EtherentBoardcastReceiverandroid:enabledtrueandroid:exportedtrueintent-filter android:priority1000action android:nameandroid.net.action.ETHERNET_IP_CHANGED //intent-filter/receiver !-- This is the longest AndroidManifest.xml ever. --/application/manifest Index: packages/apps/Settings/src/com/android/settings/ethernet/EtherentBoardcastReceive.java--- packages/apps/Settings/src/com/android/settings/ethernet/EtherentBoardcastReceive.java (nonexistent)packages/apps/Settings/src/com/android/settings/ethernet/EtherentBoardcastReceive.java (revision 869)-0,0 1,220 package com.android.settings.ethernet;import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment;import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.admin.DevicePolicyManager; import android.content.ActivityNotFoundException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.res.Resources; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManager; import android.preference.CheckBoxPreference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceScreen; import android.provider.SearchIndexableResource; import android.provider.Settings; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import android.content.Intent;import androidx.preference.SwitchPreference; import androidx.preference.ListPreference; import androidx.preference.Preference;import java.io.File; import java.io.FileDescriptor; import java.io.File; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader;import java.util.regex.Pattern; import java.lang.Integer; import java.net.InetAddress; import java.net.Inet4Address; import java.util.Iterator; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List;import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceClickListener;import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;/*for 5.0*/ import android.net.EthernetManager; import android.net.IpConfiguration; import android.net.IpConfiguration.IpAssignment; import android.net.IpConfiguration.ProxySettings; import android.net.wifi.SupplicantState; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.net.StaticIpConfiguration; import android.net.NetworkUtils; import android.net.LinkAddress; import android.net.LinkProperties; import android.widget.Toast; //import android.preference.ListPreference; //import com.android.internal.logging.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;import com.android.settings.ethernet.ethernet_static_ip_dialog; public class EtherentBoardcastReceiver extends BroadcastReceiver {private static final String TAG EtherentBoardcastReceiver;private static String mEthMode nullprivate static String mEthIpAddress null;private static String mEthNetmask null;private static String mEthGateway null;private static String mEthdns1 null;private static String mEthdns2 null;private final static String nullIpInfo 0.0.0.0;private String mIfaceName;Overridepublic void onReceive(Context context, Intent intent) {IpConfiguration mIpConfiguration;StaticIpConfiguration mStaticIpConfiguration;String action intent.getAction();Log.i(TAG, receive a new action : action);EthernetManager mEthManager (EthernetManager) context.getSystemService(Context.ETHERNET_SERVICE);if(mEthManager null){Log.i(TAG, fail to getSystemService : Context.ETHERNET_SERVICE);}mStaticIpConfiguration new StaticIpConfiguration();getNetConfigFromIntent(intent);/** get ip address, netmask,dns ,gw etc.*/String[] ifaces mEthManager.getAvailableInterfaces();if (ifaces.length 0) {mIfaceName ifaces[0];//eth0;}if (null mIfaceName) {Log.e(TAG, get ethernet ifaceName failed);}if (mEthMode null ||mEthMode.equals(static)){Inet4Address inetAddr getIPv4Address(this.mEthIpAddress);int prefixLength maskStr2InetMask(this.mEthNetmask); InetAddress gatewayAddr getIPv4Address(this.mEthGateway); InetAddress dnsAddr1 getIPv4Address(this.mEthdns1);InetAddress dnsAddr2 getIPv4Address(this.mEthdns2);if(inetAddr null || gatewayAddr null || prefixLength 0 ){Log.e(TAG,ip,mask or dnsAddr is wrong);return ;}if (inetAddr.getAddress().toString().isEmpty() || prefixLength 0 || gatewayAddr.toString().isEmpty()) {Log.e(TAG,ip,mask or dnsAddr is wrong);return ;}mStaticIpConfiguration.ipAddress new LinkAddress(inetAddr, prefixLength);mStaticIpConfiguration.gatewaygatewayAddr;if(dnsAddr1 ! null !dnsAddr1.toString().isEmpty())mStaticIpConfiguration.dnsServers.add(dnsAddr1);if(dnsAddr2 ! null !dnsAddr2.toString().isEmpty())mStaticIpConfiguration.dnsServers.add(dnsAddr2);mIpConfigurationnew IpConfiguration(IpAssignment.STATIC, ProxySettings.NONE,mStaticIpConfiguration,null); mEthManager.setConfiguration(mIfaceName, mIpConfiguration); }else{mEthManager.setConfiguration(mIfaceName, new IpConfiguration(IpAssignment.DHCP, ProxySettings.NONE,null,null));}//}private void getNetConfigFromIntent(Intent intent){Bundle bundle intent.getExtras();if (bundle.getString(netMode) ! null)this.mEthMode bundle.getString(netMode);if (bundle.getString(ipaddr) ! null)this.mEthIpAddress bundle.getString(ipaddr);if (bundle.getString(netMask)! null)this.mEthNetmask bundle.getString(netMask);if (bundle.getString(gateway)! null)this.mEthGateway bundle.getString(gateway);if (bundle.getString(dns1) ! null)this.mEthdns1 bundle.getString(dns1);if (bundle.getString(dns2) ! null)this.mEthdns2 bundle.getString(dns2);}private Inet4Address getIPv4Address(String text) {try {return (Inet4Address) NetworkUtils.numericToInetAddress(text);} catch (IllegalArgumentException|ClassCastException e) {return null;}}/** convert subMask string to prefix length*/private int maskStr2InetMask(String maskStr) {StringBuffer sb ;String str;int inetmask 0; int count 0;/** check the subMask format*/Pattern pattern Pattern.compile((^((\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[01]?\\d\\d|2[0-4]\\d|25[0-5])$)|^(\\d|[1-2]\\d|3[0-2])$);if (pattern.matcher(maskStr).matches() false) {Log.e(TAG,subMask is error);return 0;}String[] ipSegment maskStr.split(\\.);for(int n 0; nipSegment.length;n) {sb new StringBuffer(Integer.toBinaryString(Integer.parseInt(ipSegment[n])));str sb.reverse().toString();count0;for(int i0; istr.length();i) {istr.indexOf(1,i);if(i-1) break;count;}inetmaskcount;}return inetmask;}}
http://www.yutouwan.com/news/324536/

相关文章:

  • 湖南网站优化代运营网站开发好
  • 博客网站登录百度关键词seo排名
  • 直播网站建设费用河北沙河市规划局或建设局网站
  • 特色企业网站深圳龙华建设工程交易中心网站
  • 网站制作模板教案受大众喜欢的域名备案加急
  • 网站做360推广需要什么条件全国分站seo
  • 江苏公司网站建设公司wordpress做视频网站吗
  • php自适应网站开发山东建设发展研究院网站
  • 有高并发,高访问量网站开发wordpress手机图标没了
  • 教育学校网站做电商优惠券网站 建设
  • 做网站用什么国外的空间比较好建设银行网站怎么登陆密码忘了怎么办
  • 揭东建设局网站海淀深圳网站建设公司价格
  • 制作简单公司网站流程手机网站怎么做优化
  • 六安人论坛招聘求职北京seo顾问服务
  • 网站重新备案网站建站网站496565
  • 广州品牌网站设计建设微信开发者工具使用教程整套
  • 做网站页面用什么wordpress文章不登录看不到
  • 新手做网站免费域名摄影网站建设任务书
  • 上犹建设局网站贵州省建设网站
  • 深圳网站维护优化网站修改flashfxp上传多久生效
  • 网络规划设计师2024年考试seo是什么简称
  • 东莞市网站建设品牌建筑公司网站md0095设计风格
  • 网站开发技术和工具郑州网站推广单位
  • 电子商务网站建设与管理试题做平台的网站有哪些内容
  • 东莞网站建站公司如何做美食网站
  • 宁波网站推广建站新桥企业网站建设
  • 做电影网站主机放哪比较好制作网页用什么软件
  • 域名交易网站哪个好wordpress模板2018
  • 公司的网站如何建设网站开发需求用什么软件
  • 域名抢注网站做的网站需要什么技术支持