本文整理匯總了Java中com.parse.ParseUser.logOutInBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseUser.logOutInBackground方法的具體用法?Java ParseUser.logOutInBackground怎麽用?Java ParseUser.logOutInBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseUser
的用法示例。
在下文中一共展示了ParseUser.logOutInBackground方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: logout
import com.parse.ParseUser; //導入方法依賴的package包/類
public void logout() {
if (mMockParse != null) {
mMockParse.setIsLoggedIn(false);
if (isInstrumentationTest()) {
LocationTrackingService.stop();
EventBus.getDefault()
.post(new LogoutEvent(null));
}
} else {
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
if (e != null) {
EventBus.getDefault()
.post(new LogoutEvent(e));
} else {
LocationTrackingService.stop();
EventBus.getDefault()
.post(new LogoutEvent(null));
}
}
});
}
}
示例2: actuallyLogout
import com.parse.ParseUser; //導入方法依賴的package包/類
private void actuallyLogout() {
final ProgressDialog pd = new ProgressDialog(getContext());
pd.setMessage(getContext().getString(R.string.performingLogout));
pd.setCancelable(false);
pd.show();
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
pd.dismiss();
pd.cancel();
if(e != null) {
Toast.makeText(getContext(), getContext().getString(R.string.performedLogoutError), Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getContext(), getContext().getString(R.string.performedLogoutSuccess), Toast.LENGTH_SHORT).show();
LoginManager.getInstance().logout();
((MainActivity) getActivity()).updateDrawer();
((MainActivity)getActivity()).openDrawer();
((MainActivity)getActivity()).setupEventFragment();
}
}
});
}
示例3: onSnackListUpdateComplete
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void onSnackListUpdateComplete(ParseException e) {
// Start the login activity if the session token is invalid.
if(e != null && e.getCode() == ParseException.INVALID_SESSION_TOKEN){
if(myActivity != null){
Intent startLoginIntent = new Intent(myActivity, LoginActivity.class);
ParseUser.logOutInBackground();
myActivity.finish();
startActivity(startLoginIntent);
}
}
adapter.notifyDataSetChanged();
if(progressOverlay != null){
progressOverlay.setVisibility(View.GONE);
}
// Show the help message if appropriate.
// That is, if we haven't already showed it for the current user this session and the
// current user has zero entries. Only show the help message if the SnackList is pointing
// at the current user.
if(lastShowedHelpFor != ParseUser.getCurrentUser()
&& !showingHelp && SnackList.getInstance().size() == 0
&& ParseUser.getCurrentUser().equals(SnackList.getInstance().getUser())){
try{
showHelpMessage();
} catch(IllegalStateException ignored){
// In the case that onSaveInstanceState has been already been called, we ignore
// the exception.
}
}
}
示例4: onOptionsItemSelected
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_signout) {
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
if(e == null){
Intent i = new Intent(getApplicationContext(), SignOnActivity.class);
startActivity(i);
finish();
}
else{
//couldn't log out
e.printStackTrace();
}
}
});
return true;
}
return super.onOptionsItemSelected(item);
}
示例5: logout
import com.parse.ParseUser; //導入方法依賴的package包/類
/**
* Logs out the current user and starts the new account activity.
* Just starts the new account activity is no user is logged in
*/
private void logout(){
ParseUser.logOutInBackground(new LogOutCallback() {
@Override
public void done(ParseException e) {
if(e == null){
startLoginActivity();
} else{
updateToast(e.getMessage(), Toast.LENGTH_LONG);
}
}
});
}
示例6: executeLogout
import com.parse.ParseUser; //導入方法依賴的package包/類
public void executeLogout(){
ParseUser.logOutInBackground();
clearLogin();
}