android版高仿淘宝客户端源码V2.3,这个版本我已经更新到2.3了,源码也上传到源码天堂那里了,大家可以看一下吧,该应用实现了我们常用的购物功能了,也就是在手机上进行网购的流程的,如查看产品(浏览),下订单,进行付款等流程,该应用一一实现了,同时还可以远程读取图片功能,和实时监控网络状态等操作,大家如果有什么不同的意见可以留下,我们会定时来查看。
代码:
package com.android.service; import com.android.until.NetState; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.ConnectivityManager; import android.net.NetworkInfo.State; import android.util.Log; import android.widget.Toast; //ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); public class NetChangeReceiver extends BroadcastReceiver { @SuppressWarnings("static-access") @Override public void onReceive(Context context, Intent intent) { // 获得网络连接服务 ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); // State state = connManager.getActiveNetworkInfo().getState(); State state = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI) .getState(); // 获取网络连接状态 if (State.CONNECTED == state) { // 判断是否正在使用WIFI网络 Toast.makeText(context, "wifi网络可用", Toast.LENGTH_LONG).show(); NetState.getInstance().setWifiState(true); } else if (state == State.CONNECTING) { Toast.makeText(context, "wifi正在连接", Toast.LENGTH_LONG).show(); NetState.getInstance().setWifiState(false); state = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) .getState(); // 获取网络连接状态 if (State.CONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(true); } else if (State.DISCONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(false); } } else if (state == State.DISCONNECTED) { Toast.makeText(context, "wifi不可用", Toast.LENGTH_LONG).show(); NetState.getInstance().setWifiState(false); state = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) .getState(); // 获取网络连接状态 if (State.CONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(true); Toast.makeText(context, "2G/3G网络可用", Toast.LENGTH_LONG).show(); } else if (State.DISCONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(false); Toast.makeText(context, "2G/3G网络不可用", Toast.LENGTH_LONG).show(); state = connManager.getNetworkInfo( ConnectivityManager.TYPE_MOBILE).getState(); // 获取网络连接状态 if (State.CONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(true); Toast.makeText(context, "2G/3G网络可用", Toast.LENGTH_LONG) .show(); } else if (State.DISCONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(false); Toast.makeText(context, "2G/3G网络不可用", Toast.LENGTH_LONG) .show(); } } } else if (state == State.DISCONNECTING) { Toast.makeText(context, "wifi断开断开中", Toast.LENGTH_LONG).show(); NetState.getInstance().setWifiState(false); state = connManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) .getState(); // 获取网络连接状态 if (State.CONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(true); } else if (State.DISCONNECTED == state) { // 判断是否正在使用GPRS网络 NetState.getInstance().getInstance().setGprsState(false); } } if (!NetState.getInstance().getInstance().isGprsState() && !NetState.getInstance().getInstance().isWifiState()) { Toast.makeText(context, "您的网络连接已中断", Toast.LENGTH_LONG).show(); } } }
<ignore_js_op>
<ignore_js_op>
<ignore_js_op>
<ignore_js_op>