本文整理匯總了Java中com.parse.ParseUser.getCurrentUser方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseUser.getCurrentUser方法的具體用法?Java ParseUser.getCurrentUser怎麽用?Java ParseUser.getCurrentUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseUser
的用法示例。
在下文中一共展示了ParseUser.getCurrentUser方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Button verifyPhoneLogin = (Button) findViewById(R.id.start_phone_login);
verifyPhoneLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
onPhoneLogin();
}
});
loginFormView = findViewById(R.id.login_form);
progressView = findViewById(R.id.login_progress);
// Log out any existing session
ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser != null) {
ParseUser.logOut();
}
}
示例2: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewPager vpPager = (ViewPager) findViewById(R.id.vpPager);
adapterViewPager = new MyPagerAdapter(getSupportFragmentManager(),getApplicationContext());
vpPager.setAdapter(adapterViewPager);
ParseUser currentUser = ParseUser.getCurrentUser();
if (ParseAnonymousUtils.isLinked(currentUser) || currentUser==null) {
// If user is anonymous, send the user to LoginSignupActivity.class
Intent intent = new Intent(HomeActivity.this,
LoginSignupActivity.class);
startActivity(intent);
finish();
}
}
示例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: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (ParseUser.getCurrentUser() != null) {
getSelectedChannel();
Log.e(LOG_TAG, "User is already logged in: " + ParseUser.getCurrentUser().get(Constants.PARSE_USER_ATTR_NAME));
// showFeed();
} else {
retrieveChannels();
Log.e(LOG_TAG, "User not logged in");
}
}
示例5: initChangePass
import com.parse.ParseUser; //導入方法依賴的package包/類
public void initChangePass(final View v) {
if (mPasswordField.getText().length() == 0) {
mPasswordField.setText("Password can't be empty!");
return;
}
v.setEnabled(false);
spinner.setVisibility(View.VISIBLE);
mErrorField.setText("");
InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(mPasswordField.getWindowToken(), 0);
ParseUser curUser = ParseUser.getCurrentUser();
curUser.setPassword(mPasswordField.getText().toString());
curUser.saveInBackground();
spinner.setVisibility(View.GONE);
}
示例6: verificarUsuarioLogado
import com.parse.ParseUser; //導入方法依賴的package包/類
private void verificarUsuarioLogado() {
if (ParseUser.getCurrentUser() != null) {
//Enviar usuário para tela principal do App
abrirAreaPrincipal();
finish();
}
}
示例7: installupdate
import com.parse.ParseUser; //導入方法依賴的package包/類
private void installupdate() {
ParseInstallation pinst = ParseInstallation.getCurrentInstallation();
ParseUser puser = ParseUser.getCurrentUser();
if (puser != null) {
pinst.put("username", puser.getUsername());
pinst.saveInBackground();
}
}
示例8: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mCourse = getArguments().getString(ARG_COURSE);
mLabCount = getArguments().getInt(ARG_LAB_COUNT);
}
labtech = ParseUser.getCurrentUser();
setRetainInstance(true);
}
示例9: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
getSupportFragmentManager().beginTransaction()
.add(R.id.container,LoginFragment.newInstance())
.commit();
ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser != null) {
onLoginSuccessful();
}
}
示例10: onSharedPreferenceChanged
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals("pref_distance")) {
Preference pref = findPreference(key);
pref.setSummary(sharedPreferences.getString(key, ""));
ParseUser pu = ParseUser.getCurrentUser();
Log.d("SETTINGS", sharedPreferences.getString(key, "100"));
pu.put("distance", Float.parseFloat(sharedPreferences.getString(key, "100"))/1000.0);
pu.saveEventually();
}
}
示例11: onStartCommand
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
Log.e("Network Loc Service", "Service running");
AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
Calendar timeOff9 = Calendar.getInstance();
Intent intent2 = new Intent(this,MyReceiver.class);
PendingIntent sender = PendingIntent.getBroadcast(this, 0, intent2,
PendingIntent.FLAG_UPDATE_CURRENT);
am.set(AlarmManager.RTC_WAKEUP, timeOff9.getTimeInMillis() + 55000, sender);
ParseGeoPoint pt = new ParseGeoPoint(getLocation().getLatitude(),getLocation().getLongitude());
ParseUser person = ParseUser.getCurrentUser();
if(person==null)
{
stopSelf();
return 0;
}
person.put("Geolocation",pt);
person.saveInBackground();
return START_STICKY;
}
示例12: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Check if user is logged in
ParseUser currentUser = ParseUser.getCurrentUser();
if (currentUser == null) {
launchLoginActivity();
}
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
示例13: run
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void run() {
try {
mSocket = new Socket(mHost, mPort);
mOut = new OutputStreamWriter(mSocket.getOutputStream());
mIn = new BufferedReader(new InputStreamReader(mSocket.getInputStream()));
Log.d(TAG, "Connected to socket notification server");
// Send subscription request
if (ParseUser.getCurrentUser() != null) {
final String id = ParseUser.getCurrentUser().getObjectId();
mOut.write("{\"type\":\"register\", \"value\":\"" + id + "\"}");
mOut.flush();
}
// Start listening for notifications
while (true) {
final String data = mIn.readLine();
if (data == null) {
throw new IOException("Socket dropped?");
}
JSONObject json = new JSONObject(data);
onNotification(json);
Log.d(TAG, "Received data from notification server: " + data);
}
}
catch (Exception e) {
Log.e(TAG, "Exception on socket thread", e);
cleanup();
scheduleRestart();
}
Log.d(TAG, "Socket notification thread stopping");
}
示例14: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (ParseUser.getCurrentUser() != null) {
openConversationsList();
}
else {
openLogin();
}
finish();
}
示例15: signOutFromGplus
import com.parse.ParseUser; //導入方法依賴的package包/類
/**
* Sign-out from google
* */
public void signOutFromGplus() {
if (mGoogleApiClient.isConnected()) {
if(ParseUser.getCurrentUser() != null){
ParseUser.logOut();
}
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
mGoogleApiClient.disconnect();
mGoogleApiClient.connect();
updateUI(false);
}
}