Java Code Examples for com.gizwits.gizwifisdk.api.GizWifiSDK
The following examples show how to use
com.gizwits.gizwifisdk.api.GizWifiSDK. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: GOpenSource_AppKit_Android_AS Source File: GosPushManager.java License: MIT License | 6 votes |
public static void pushUnBindService(String token) { if (token.isEmpty()) { return; } if (GizPushType.GizPushJiGuang == gizPushType) { // 获取JPush的RegistrationID,即Channel_ID Channel_ID = JPushInterface.getRegistrationID(context); } else if (GizPushType.GizPushBaiDu == gizPushType) { // 获取BDPush的Channel_ID Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID; } else { return; } // TODO 绑定推送 Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token); GizWifiSDK.sharedInstance().channelIDUnBind(token, Channel_ID); }
Example 2
Source Project: Gizwits-SmartBuld_Android Source File: GosDeviceListActivity.java License: MIT License | 6 votes |
@Override protected void onResume() { super.onResume(); // TODO GosMessageHandler.getSingleInstance().SetHandler(handler); if (boundMessage.size() != 0) { progressDialog.show(); if (boundMessage.size() == 2) { GizWifiSDK.sharedInstance().bindDevice(uid, token, boundMessage.get(0), boundMessage.get(1), null); } else if (boundMessage.size() == 1) { GizWifiSDK.sharedInstance().bindDeviceByQRCode(uid, token, boundMessage.get(0)); } else { Log.i("Apptest", "ListSize:" + boundMessage.size()); } }else { GosDeviceModuleBaseActivity.deviceslist = GizWifiSDK.sharedInstance().getDeviceList(); UpdateUI(); } }
Example 3
Source Project: Gizwits-SmartBuld_Android Source File: GosPushManager.java License: MIT License | 6 votes |
public static void pushUnBindService(String token) { if (token.isEmpty()) { return; } if (GizPushType.GizPushJiGuang == gizPushType) { // 获取JPush的RegistrationID,即Channel_ID Channel_ID = JPushInterface.getRegistrationID(context); } else if (GizPushType.GizPushBaiDu == gizPushType) { // 获取BDPush的Channel_ID Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID; } else { return; } // TODO 绑定推送 Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token); GizWifiSDK.sharedInstance().channelIDUnBind(token, Channel_ID); }
Example 4
Source Project: Gizwits-SmartBuld_Android Source File: GosApplication.java License: MIT License | 6 votes |
public void onCreate() { super.onCreate(); // 读取配置文件 gosDeploy = new GosDeploy(this); String AppID = GosDeploy.setAppID(); String AppSecret = GosDeploy.setAppSecret(); if (TextUtils.isEmpty(AppID) || AppID.contains("your_app_id") || TextUtils.isEmpty(AppSecret) || AppSecret.contains("your_app_secret")) { if (flag == 0) { } flag++; } else { // 启动SDK GizWifiSDK.sharedInstance().startWithAppID(getApplicationContext(), AppID, null, null); // 设置日志等级和云端服务 handler.sendEmptyMessageDelayed(0, 3000); } }
Example 5
Source Project: gokit-android Source File: GosDeviceListActivity.java License: MIT License | 6 votes |
@Override protected void onResume() { super.onResume(); GosDeviceModuleBaseActivity.deviceslist=GizWifiSDK.sharedInstance().getDeviceList(); UpdateUI(); // TODO GosMessageHandler.getSingleInstance().SetHandler(handler); if (boundMessage.size() != 0) { progressDialog.show(); if (boundMessage.size() == 2) { GizWifiSDK.sharedInstance().bindDevice(uid, token, boundMessage.get(0), boundMessage.get(1), null); } else if (boundMessage.size() == 1) { GizWifiSDK.sharedInstance().bindDeviceByQRCode(uid, token, boundMessage.get(0)); } else { Log.i("Apptest", "ListSize:" + boundMessage.size()); } } }
Example 6
Source Project: gokit-android Source File: GosPushManager.java License: MIT License | 6 votes |
public static void pushUnBindService(String token) { if (token.isEmpty()) { return; } if (GizPushType.GizPushJiGuang == gizPushType) { // 获取JPush的RegistrationID,即Channel_ID Channel_ID = JPushInterface.getRegistrationID(context); } else if (GizPushType.GizPushBaiDu == gizPushType) { // 获取BDPush的Channel_ID Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID; } else { return; } // TODO 绑定推送 Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token); GizWifiSDK.sharedInstance().channelIDUnBind(token, Channel_ID); }
Example 7
Source Project: gokit-android Source File: MessageCenter.java License: MIT License | 6 votes |
private void init(Context c) { gosDeploy = new GosDeploy(c); String AppID = GosDeploy.setAppID(); String AppSecret = GosDeploy.setAppSecret(); if (TextUtils.isEmpty(AppID) || AppID.contains("your_app_id") || TextUtils.isEmpty(AppSecret) || AppSecret.contains("your_app_secret")) { String AppID_Toast = c.getString(R.string.AppID_Toast); if (flag == 0) { Toast.makeText(c, AppID_Toast, Toast.LENGTH_LONG).show(); } flag++; } else { // 启动SDK ConcurrentHashMap<String, String> serverMap = new ConcurrentHashMap<String, String>(); serverMap.put("openAPIInfo", TextUtils.isEmpty((String) GosDeploy.infoMap.get("openAPIDomain")) ? "api.gizwits.com" : (String) GosDeploy.infoMap.get("openAPIDomain")); serverMap.put("siteInfo", TextUtils.isEmpty((String) GosDeploy.infoMap.get("siteDomain")) ? "site.gizwits.com" : (String) GosDeploy.infoMap.get("siteDomain")); serverMap.put("pushInfo", (String) GosDeploy.infoMap.get("pushDomain")); GizWifiSDK.sharedInstance().startWithAppID(c, AppID, GosDeploy.setProductKeyList(), serverMap, false); } hand.sendEmptyMessageDelayed(SETCLOUD, 3000); }
Example 8
Source Project: GOpenSource_AppKit_Android_AS Source File: GosPushManager.java License: MIT License | 5 votes |
/** * 向云端绑定推送 * * @param Token * @param Channel_ID * @param gizPushType */ public static void pushBindService(String token) { if (GizPushType.GizPushJiGuang == gizPushType) { // 获取JPush的RegistrationID,即Channel_ID Channel_ID = JPushInterface.getRegistrationID(context); // 设定JPush类型 JPushInterface.setAlias(context, Channel_ID, new TagAliasCallback() { @Override public void gotResult(int arg0, String arg1, Set<String> arg2) { if (arg0 == 0) { Log.i("Apptest", "Alias: " + arg1); } else { Log.e("Apptest", "Result: " + arg0); } } }); } else if (GizPushType.GizPushBaiDu == gizPushType) { // 获取BDPush的Channel_ID Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID; } else { return; } // TODO 绑定推送 Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token); GizWifiSDK.sharedInstance().channelIDBind(token, Channel_ID, gizPushType); }
Example 9
Source Project: GOpenSource_AppKit_Android_AS Source File: MessageCenter.java License: MIT License | 5 votes |
private void init(Context c) { gosDeploy = new GosDeploy(c); String AppID = GosDeploy.setAppID(); String AppSecret = GosDeploy.setAppSecret(); if (TextUtils.isEmpty(AppID) || AppID.contains("your_app_id") || TextUtils.isEmpty(AppSecret) || AppSecret.contains("your_app_secret")) { String AppID_Toast = c.getString(R.string.AppID_Toast); if (flag == 0) { Toast.makeText(c, AppID_Toast, Toast.LENGTH_LONG).show(); } flag++; } else { // 启动SDK ConcurrentHashMap<String, String> serverMap = new ConcurrentHashMap<String, String>(); serverMap.put("openAPIInfo", TextUtils.isEmpty((String) GosDeploy.infoMap.get("openAPI_URL")) ? "api.gizwits.com" : (String) GosDeploy.infoMap.get("openAPI_URL")); serverMap.put("siteInfo", TextUtils.isEmpty((String) GosDeploy.infoMap.get("site_URL")) ? "site.gizwits.com" : (String) GosDeploy.infoMap.get("site_URL")); serverMap.put("pushInfo", (String) GosDeploy.infoMap.get("push_URL")); //GizWifiSDK.sharedInstance().startWithAppID(c, AppID, GosDeploy.setProductKeyList(), serverMap); GizWifiSDK.sharedInstance().startWithAppID(c, AppID, AppSecret, GosDeploy.setProductKeyList(), serverMap, false); } hand.sendEmptyMessageDelayed(SETCLOUD, 3000); }
Example 10
Source Project: GOpenSource_AppKit_Android_AS Source File: GosChangeUserPasswordActivity.java License: MIT License | 5 votes |
@Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); GizWifiSDK.sharedInstance().setListener(listener); }
Example 11
Source Project: Gizwits-SmartBuld_Android Source File: GosDeviceControlModuleBaseActivity.java License: MIT License | 5 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); // 每次打开页面都注册一次device监听器,保证能收到设备数据 if (device != null) { device.setListener(gizWifiDeviceListener); } }
Example 12
Source Project: Gizwits-SmartBuld_Android Source File: GosDeviceMoreActivity.java License: MIT License | 5 votes |
private void unboundAtion() { setProgressDialog(getResources().getString(R.string.unbounding_device), true, true); // 显示等待栏 progressDialog.show(); GizWifiSDK.sharedInstance().unbindDevice(spf.getString("Uid", ""), spf.getString("Token", ""), device.getDid()); }
Example 13
Source Project: Gizwits-SmartBuld_Android Source File: GosAboutActivity.java License: MIT License | 5 votes |
@Override public void onResume() { super.onResume(); // tv_SDKVersion.setText("V" + GizWifiSDK.sharedInstance().getVersion().toString()); tv_SDKVersion.setText(GizWifiSDK.sharedInstance().getVersion().toString()); tv_AppVersion.setText(getAppVersionName(this)); }
Example 14
Source Project: Gizwits-SmartBuld_Android Source File: GosPushManager.java License: MIT License | 5 votes |
/** * 向云端绑定推送 * * @param Token * @param Channel_ID * @param gizPushType */ public static void pushBindService(String token) { if (GizPushType.GizPushJiGuang == gizPushType) { // 获取JPush的RegistrationID,即Channel_ID Channel_ID = JPushInterface.getRegistrationID(context); // 设定JPush类型 JPushInterface.setAlias(context, Channel_ID, new TagAliasCallback() { @Override public void gotResult(int arg0, String arg1, Set<String> arg2) { if (arg0 == 0) { Log.i("Apptest", "Alias: " + arg1); } else { Log.e("Apptest", "Result: " + arg0); } } }); } else if (GizPushType.GizPushBaiDu == gizPushType) { // 获取BDPush的Channel_ID Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID; } else { return; } // TODO 绑定推送 Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token); GizWifiSDK.sharedInstance().channelIDBind(token, Channel_ID, gizPushType); }
Example 15
Source Project: gokit-android Source File: GosPushManager.java License: MIT License | 5 votes |
/** * 向云端绑定推送 * * @param Token * @param Channel_ID * @param gizPushType */ public static void pushBindService(String token) { if (GizPushType.GizPushJiGuang == gizPushType) { // 获取JPush的RegistrationID,即Channel_ID Channel_ID = JPushInterface.getRegistrationID(context); // 设定JPush类型 JPushInterface.setAlias(context, Channel_ID, new TagAliasCallback() { @Override public void gotResult(int arg0, String arg1, Set<String> arg2) { if (arg0 == 0) { Log.i("Apptest", "Alias: " + arg1); } else { Log.e("Apptest", "Result: " + arg0); } } }); } else if (GizPushType.GizPushBaiDu == gizPushType) { // 获取BDPush的Channel_ID Channel_ID = BaiDuPushReceiver.BaiDuPush_Channel_ID; } else { return; } // TODO 绑定推送 Log.i("Apptest", Channel_ID + "\n" + gizPushType.toString() + "\n" + token); GizWifiSDK.sharedInstance().channelIDBind(token, Channel_ID, gizPushType); }
Example 16
Source Project: GOpenSource_AppKit_Android_AS Source File: GosDeviceModuleBaseActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); }
Example 17
Source Project: GOpenSource_AppKit_Android_AS Source File: GosDeviceListActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); GizDeviceSharing.setListener(new GizDeviceSharingListener() { @Override public void didCheckDeviceSharingInfoByQRCode(GizWifiErrorCode result, String userName, String productName, String deviceAlias, String expiredAt) { // TODO Auto-generated method stub super.didCheckDeviceSharingInfoByQRCode(result, userName, productName, deviceAlias, expiredAt); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } int errorcode = result.ordinal(); if (8041 <= errorcode && errorcode <= 8050 || errorcode == 8308) { Toast.makeText(GosDeviceListActivity.this, getResources().getString(R.string.sorry), 1).show(); } else if (errorcode != 0) { Toast.makeText(GosDeviceListActivity.this, getResources().getString(R.string.verysorry), 1).show(); } else { Intent tent = new Intent(GosDeviceListActivity.this, gosZxingDeviceSharingActivity.class); tent.putExtra("userName", userName); tent.putExtra("productName", productName); tent.putExtra("deviceAlias", deviceAlias); tent.putExtra("expiredAt", expiredAt); tent.putExtra("code", boundMessage.get(2)); startActivity(tent); } } }); GosDeviceModuleBaseActivity.deviceslist = GizWifiSDK.sharedInstance().getDeviceList(); UpdateUI(); // TODO GosMessageHandler.getSingleInstance().SetHandler(handler); if (boundMessage.size() != 0) { progressDialog.show(); if (boundMessage.size() == 2) { GizWifiSDK.sharedInstance().bindDevice(uid, token, boundMessage.get(0), boundMessage.get(1), null); } else if (boundMessage.size() == 1) { GizWifiSDK.sharedInstance().bindDeviceByQRCode(uid, token, boundMessage.get(0)); } else if (boundMessage.size() == 3) { GizDeviceSharing.checkDeviceSharingInfoByQRCode(spf.getString("Token", ""), boundMessage.get(2)); } else { Log.i("Apptest", "ListSize:" + boundMessage.size()); } } }
Example 18
Source Project: GOpenSource_AppKit_Android_AS Source File: GosAboutActivity.java License: MIT License | 4 votes |
@Override public void onResume() { super.onResume(); tv_SDKVersion.setText(GizWifiSDK.sharedInstance().getVersion().toString()); tv_AppVersion.setText(getAppVersionName(this)); }
Example 19
Source Project: GOpenSource_AppKit_Android_AS Source File: GosConfigCountdownActivity.java License: MIT License | 4 votes |
private void readyToSoftAP() { // 切换至设备热点 WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID); WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager); manager.connect(softSSID, SoftAP_PSW, cipherType); IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); workSSID = spf.getString("workSSID", ""); workSSIDPsw = spf.getString("workSSIDPsw", ""); final Timer mtimer = new Timer(); mtimer.schedule(new TimerTask() { @Override public void run() { if (progressDialog.isShowing()) { progressDialog.cancel(); mtimer.cancel(); String failText=(String) getText(R.string.configuration_failed); Message msg=new Message(); msg.what=handler_key.FAILED.ordinal(); msg.obj=failText; handler.sendMessage(msg); } else { mtimer.cancel(); } } }, 10 * 1000); isChecked = true; while (isChecked) { String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this); if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) { if (checkNetwork(GosConfigCountdownActivity.this)) { progressDialog.cancel(); isChecked = false; handler.sendEmptyMessage(handler_key.START_TIMER.ordinal()); GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null); // handler.sendEmptyMessageDelayed(handler_key.OFFTIME.ordinal(), 2000); } if(broadcase==null){ broadcase = new GosWifiChangeReciver(); registerReceiver(broadcase, filter); } } } }
Example 20
Source Project: GOpenSource_AppKit_Android_AS Source File: GosConfigModuleBaseActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); }
Example 21
Source Project: GOpenSource_AppKit_Android_AS Source File: GosAirlinkConfigCountdownActivity.java License: MIT License | 4 votes |
private void startAirlink() { GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiAirLink, null, 60, modeList); handler.sendEmptyMessage(handler_key.START_TIMER.ordinal()); }
Example 22
Source Project: GOpenSource_AppKit_Android_AS Source File: GosUserModuleBaseActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); }
Example 23
Source Project: GOpenSource_AppKit_Android_AS Source File: GosChangeUserPasswordActivity.java License: MIT License | 4 votes |
public void confirm(View v) { if (TextUtils.isEmpty(oldpass.getText().toString()) || TextUtils.isEmpty(newpass.getText().toString()) || TextUtils.isEmpty(confrimpass.getText().toString())) { if (TextUtils.isEmpty(oldpass.getText().toString())) { Toast.makeText( this, getResources().getString( R.string.enter_current_password), 2000).show(); return; } if (TextUtils.isEmpty(newpass.getText().toString())) { Toast.makeText(this, getResources().getString(R.string.enter_new_password), 2000).show(); return; } if (TextUtils.isEmpty(confrimpass.getText().toString())) { Toast.makeText( this, getResources() .getString(R.string.re_enter_new_password), 2000).show(); return; } } else { String npass = newpass.getText().toString(); String cpass = confrimpass.getText().toString(); if (npass.equals(cpass)) { GizWifiSDK.sharedInstance().changeUserPassword( spf.getString("Token", ""), oldpass.getText().toString(), npass); } else { Toast.makeText(this, getResources().getString(R.string.nosamepass), 2000) .show(); } } }
Example 24
Source Project: Gizwits-SmartBuld_Android Source File: GosDeviceModuleBaseActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); }
Example 25
Source Project: Gizwits-SmartBuld_Android Source File: GosConfigCountdownActivity.java License: MIT License | 4 votes |
private void readyToSoftAP() { // 切换至设备热点 WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager); WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID); manager.connect(softSSID, SoftAP_PSW, cipherType); IntentFilter filter = new IntentFilter(); filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION); workSSID = spf.getString("workSSID", ""); workSSIDPsw = spf.getString("workSSIDPsw", ""); final Timer mtimer = new Timer(); mtimer.schedule(new TimerTask() { @Override public void run() { if (progressDialog.isShowing()) { progressDialog.cancel(); mtimer.cancel(); handler.sendEmptyMessage(handler_key.FAILED.ordinal()); } else { mtimer.cancel(); } } }, 10 * 1000); isChecked = true; while (isChecked) { String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this); if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) { if (checkNetwork(GosConfigCountdownActivity.this)) { GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null); progressDialog.cancel(); isChecked = false; handler.sendEmptyMessage(handler_key.START_TIMER.ordinal()); } registerReceiver(broadcase, filter); } } }
Example 26
Source Project: Gizwits-SmartBuld_Android Source File: GosConfigModuleBaseActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); }
Example 27
Source Project: Gizwits-SmartBuld_Android Source File: GosAirlinkConfigCountdownActivity.java License: MIT License | 4 votes |
private void startAirlink() { GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiAirLink, null, 60, modeList); handler.sendEmptyMessage(handler_key.START_TIMER.ordinal()); }
Example 28
Source Project: Gizwits-SmartBuld_Android Source File: GosUserModuleBaseActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); }
Example 29
Source Project: gokit-android Source File: GosDeviceModuleBaseActivity.java License: MIT License | 4 votes |
@Override protected void onResume() { super.onResume(); // 每次返回activity都要注册一次sdk监听器,保证sdk状态能正确回调 GizWifiSDK.sharedInstance().setListener(gizWifiSDKListener); }
Example 30
Source Project: gokit-android Source File: GosAboutActivity.java License: MIT License | 4 votes |
@Override public void onResume() { super.onResume(); tv_SDKVersion.setText(GizWifiSDK.sharedInstance().getVersion().toString()); tv_AppVersion.setText(getAppVersionName(this)); }