com.gizwits.opensource.appkit.PushModule.GosPushManager Java Examples

The following examples show how to use com.gizwits.opensource.appkit.PushModule.GosPushManager. 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 File: GosDeviceListActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
protected void didUserLogin(GizWifiErrorCode result, java.lang.String uid, java.lang.String token) {

		if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
			loginStatus = 2;
			this.uid = uid;
			this.token = token;
			spf.edit().putString("Uid", this.uid).commit();
			spf.edit().putString("Token", this.token).commit();
			handler.sendEmptyMessage(GETLIST);
			// TODO 绑定推送
			GosPushManager.pushBindService(token);
		} else {
			loginStatus = 0;
			if (GosDeploy.setAnonymousLogin()) {
				tryUserLoginAnonymous();
			}

		}
	}
 
Example #2
Source File: GosMainActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
/** 注销函数 */
void logoutToClean() {
	spf.edit().putString("UserName", "").commit();
	spf.edit().putString("PassWord", "").commit();
	spf.edit().putString("Uid", "").commit();
	spf.edit().putString("thirdUid", "").commit();

	GosPushManager.pushUnBindService(spf.getString("Token", ""));
	spf.edit().putString("Token", "").commit();

	finish();
	if (GosDeviceListActivity.loginStatus == 1) {
		GosDeviceListActivity.loginStatus = 0;
	} else {
		GosDeviceListActivity.loginStatus = 4;
	}

}
 
Example #3
Source File: GosUserManager.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
private void logoutToClean() {
	GosPushManager.pushUnBindService(spf.getString("Token", ""));
	spf.edit().putString("UserName", "").commit();
	isclean = true;
	spf.edit().putString("PassWord", "").commit();
	spf.edit().putString("Uid", "").commit();
	spf.edit().putString("Token", "").commit();

	spf.edit().putString("thirdUid", "").commit();

	if (GosDeviceListActivity.loginStatus == 1) {
		GosDeviceListActivity.loginStatus = 0;
	} else {
		GosDeviceListActivity.loginStatus = 4;
	}

}
 
Example #4
Source File: GosDeviceListActivity.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
protected void didUserLogin(GizWifiErrorCode result, java.lang.String uid, java.lang.String token) {

		if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
			loginStatus = 2;
			this.uid = uid;
			this.token = token;
			spf.edit().putString("Uid", this.uid).commit();
			spf.edit().putString("Token", this.token).commit();
			handler.sendEmptyMessage(GETLIST);
			// TODO 绑定推送
			GosPushManager.pushBindService(token);
		} else {
			loginStatus = 0;
			tryUserLoginAnonymous();
		}
	}
 
Example #5
Source File: GosDeviceListActivity.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
/** 注销函数 */
private void logoutToClean() {

	spf.edit().putString("UserName", "").commit();
	spf.edit().putString("PassWord", "").commit();
	spf.edit().putString("Uid", "").commit();
	spf.edit().putString("Token", "").commit();
	GosPushManager.pushUnBindService(token);
	finish();
	if (loginStatus == 1) {
		loginStatus = 0;
	} else {
		loginStatus = 4;
	}

}
 
Example #6
Source File: GosDeviceListActivity.java    From gokit-android with MIT License 6 votes vote down vote up
protected void didUserLogin(GizWifiErrorCode result, java.lang.String uid, java.lang.String token) {

		if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
			loginStatus = 2;
			this.uid = uid;
			this.token = token;
			spf.edit().putString("Uid", this.uid).commit();
			spf.edit().putString("Token", this.token).commit();
			handler.sendEmptyMessage(GETLIST);
			// TODO 绑定推送
			GosPushManager.pushBindService(token);
		} else {
			loginStatus = 0;
			if(GosDeploy.setAnonymousLogin()){
				tryUserLoginAnonymous();
			}
			
		}
	}
 
Example #7
Source File: GosDeviceListActivity.java    From gokit-android with MIT License 6 votes vote down vote up
/** 注销函数 */
private void logoutToClean() {

	spf.edit().putString("UserName", "").commit();
	spf.edit().putString("PassWord", "").commit();
	spf.edit().putString("Uid", "").commit();
	spf.edit().putString("Token", "").commit();
	GosPushManager.pushUnBindService(token);
	finish();
	if (loginStatus == 1) {
		loginStatus = 0;
	} else {
		loginStatus = 4;
	}

}
 
Example #8
Source File: GosUserLoginActivity.java    From gokit-android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTheme(R.style.AppTheme);
	if (!this.isTaskRoot()) {// 判断此activity是不是任务控件的源Activity,“非”也就是说是被系统重新实例化出来的
		Intent mainIntent = getIntent();
		String action = mainIntent.getAction();
		if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && action.equals(Intent.ACTION_MAIN)) {
			finish();
			return;
		}
	}
	if (GosApplication.flag != 0) {
		GosBaseActivity.noIDAlert(this, R.string.AppID_Toast);
	}

	// 在配置文件中选择推送类型(0:不开启推送,1:极光推送,2:百度推送。默认为0)
	gosPushManager = new GosPushManager(GosDeploy.setPushType(), this);

	setContentView(R.layout.activity_gos_user_login);
	// 设置actionBar
	setActionBar(false, false, R.string.app_company);
	initView();
	initEvent();
}
 
Example #9
Source File: GosDeviceListActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
/** 注销函数 */
void logoutToClean() {
	spf.edit().putString("UserName", "").commit();
	spf.edit().putString("PassWord", "").commit();
	spf.edit().putString("Uid", "").commit();
	spf.edit().putString("Token", "").commit();
	GosPushManager.pushUnBindService(token);
	finish();
	if (loginStatus == 1) {
		loginStatus = 0;
	} else {
		loginStatus = 4;
	}

}
 
Example #10
Source File: GosUserLoginActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTheme(R.style.AppTheme);
	if (!this.isTaskRoot()) {// 判断此activity是不是任务控件的源Activity,“非”也就是说是被系统重新实例化出来的
		Intent mainIntent = getIntent();
		String action = mainIntent.getAction();
		if (mainIntent.hasCategory(Intent.CATEGORY_LAUNCHER) && action.equals(Intent.ACTION_MAIN)) {
			finish();
			return;
		}
	}
	if (GosApplication.flag != 0) {
		GosBaseActivity.noIDAlert(this, R.string.AppID_Toast);
	}

	// 在配置文件中选择推送类型(0:不开启推送,1:极光推送,2:百度推送。默认为0)
	gosPushManager = new GosPushManager(GosDeploy.setPushType(), this);

	setContentView(R.layout.activity_gos_user_login);


	// 设置actionBar
	setActionBar(false, false, R.string.app_company);
	initView();
	initEvent();
}
 
Example #11
Source File: GosUserLoginActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
/**
 * 用户登录回调
 */
@Override
protected void didUserLogin(GizWifiErrorCode result, String uid, String token) {

	progressDialog.cancel();
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "User");
	if (GosDeviceListActivity.loginStatus == 4 || GosDeviceListActivity.loginStatus == 3) {
		return;
	}
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "UserLogin");

	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {// 登录失败
		Toast.makeText(GosUserLoginActivity.this, toastError(result), toastTime).show();

	} else {// 登录成功

		GosDeviceListActivity.loginStatus = 1;
		Toast.makeText(GosUserLoginActivity.this, R.string.toast_login_successful, toastTime).show();

		// TODO 绑定推送
		GosPushManager.pushBindService(token);

		if (!TextUtils.isEmpty(etName.getText().toString()) && !TextUtils.isEmpty(etPsw.getText().toString())
				&& TextUtils.isEmpty(spf.getString("thirdUid", ""))) {
			spf.edit().putString("UserName", etName.getText().toString()).commit();
			spf.edit().putString("PassWord", etPsw.getText().toString()).commit();
		}
		spf.edit().putString("Uid", uid).commit();
		spf.edit().putString("Token", token).commit();

		intent = new Intent(GosUserLoginActivity.this, GosMainActivity.class);
		intent.putExtra("ThredLogin", true);
		startActivity(intent);

	}
}
 
Example #12
Source File: GosUserLoginActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
/**
 * 用户登录回调
 */
@Override
protected void didUserLogin(GizWifiErrorCode result, String uid, String token) {

	progressDialog.cancel();
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "User");
	if (GosDeviceListActivity.loginStatus == 4 || GosDeviceListActivity.loginStatus == 3) {
		return;
	}
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "UserLogin");

	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {// 登录失败
		Toast.makeText(GosUserLoginActivity.this, toastError(result), 2000).show();

	} else {// 登录成功

		GosDeviceListActivity.loginStatus = 1;
		Toast.makeText(GosUserLoginActivity.this, R.string.toast_login_successful, 2000).show();

		// TODO 绑定推送
		GosPushManager.pushBindService(token);

		if (!TextUtils.isEmpty(etName.getText().toString()) && !TextUtils.isEmpty(etPsw.getText().toString())) {
			spf.edit().putString("UserName", etName.getText().toString()).commit();
			spf.edit().putString("PassWord", etPsw.getText().toString()).commit();
		}
		spf.edit().putString("Uid", uid).commit();
		spf.edit().putString("Token", token).commit();

		intent = new Intent(GosUserLoginActivity.this, GosDeviceListActivity.class);
		intent.putExtra("ThredLogin", true);
		startActivity(intent);
	}
}
 
Example #13
Source File: GosUserLoginActivity.java    From gokit-android with MIT License 5 votes vote down vote up
/**
 * 用户登录回调
 */
@Override
protected void didUserLogin(GizWifiErrorCode result, String uid, String token) {

	progressDialog.cancel();
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "User");
	if (GosDeviceListActivity.loginStatus == 4 || GosDeviceListActivity.loginStatus == 3) {
		return;
	}
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "UserLogin");

	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {// 登录失败
		Toast.makeText(GosUserLoginActivity.this, toastError(result), toastTime).show();

	} else {// 登录成功

		GosDeviceListActivity.loginStatus = 1;
		Toast.makeText(GosUserLoginActivity.this, R.string.toast_login_successful, toastTime).show();

		// TODO 绑定推送
		GosPushManager.pushBindService(token);

		if (!TextUtils.isEmpty(etName.getText().toString()) && !TextUtils.isEmpty(etPsw.getText().toString())) {
			spf.edit().putString("UserName", etName.getText().toString()).commit();
			spf.edit().putString("PassWord", etPsw.getText().toString()).commit();
		}
		spf.edit().putString("Uid", uid).commit();
		spf.edit().putString("Token", token).commit();

		intent = new Intent(GosUserLoginActivity.this, GosDeviceListActivity.class);
		intent.putExtra("ThredLogin", true);
		startActivity(intent);

	}
}