当前位置: 首页>>代码示例>>Java>>正文


Java Firebase.setValue方法代码示例

本文整理汇总了Java中com.firebase.client.Firebase.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Firebase.setValue方法的具体用法?Java Firebase.setValue怎么用?Java Firebase.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.firebase.client.Firebase的用法示例。


在下文中一共展示了Firebase.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPresenceImpl

import com.firebase.client.Firebase; //导入方法依赖的package包/类
private Task<Void> setPresenceImpl(User user, PresenceType newPresenceType) {
    Task<Void>.TaskCompletionSource taskSource = Task.<Void>create();

    Firebase presenceRef = firebaseRef.child(user.getPresencePath());
    String value = newPresenceType.name().toLowerCase();

    presenceRef.setValue(value, (firebaseError, firebase) -> {
        if (firebaseError != null) {
            taskSource.setError(firebaseError.toException());
        } else {
            taskSource.setResult(null);
        }
    });

    return taskSource.getTask();
}
 
开发者ID:aluxian,项目名称:Codementor,代码行数:17,代码来源:FirebaseTasks.java

示例2: markReadImpl

import com.firebase.client.Firebase; //导入方法依赖的package包/类
private Task<Void> markReadImpl(Chatroom chatroom, Message message) {
    Task<Void>.TaskCompletionSource taskSource = Task.<Void>create();

    long value = new Date().getTime();
    Firebase messageRef = firebaseRef.child(chatroom.getFirebasePath())
            .child(message.getKey())
            .child("read_at");

    messageRef.setValue(value, (firebaseError, firebase) -> {
        if (firebaseError != null) {
            taskSource.setError(firebaseError.toException());
        } else {
            taskSource.setResult(null);
        }
    });

    return taskSource.getTask();
}
 
开发者ID:aluxian,项目名称:Codementor,代码行数:19,代码来源:FirebaseTasks.java

示例3: startTravel

import com.firebase.client.Firebase; //导入方法依赖的package包/类
public static void startTravel(Context context, String travelKey, String travelTitle) {
    /*
      For switch active travel logic see listener mActiveTravelListener in BaseActivity class
    */

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
    String userUID = sharedPreferences.getString(Constants.KEY_USER_UID, null);
    String activeTravelKey = sharedPreferences.getString(Constants.KEY_ACTIVE_TRAVEL_KEY, null);
    if (activeTravelKey != null && !Constants.FIREBASE_TRAVELS_DEFAULT_TRAVEL_KEY.equals(activeTravelKey)) {
        setStopTime(context, activeTravelKey);
    }

    Map<String, Object> map = new HashMap<String, Object>();
    map.put(Constants.FIREBASE_ACTIVE_TRAVEL_TITLE, travelTitle);
    map.put(Constants.FIREBASE_ACTIVE_TRAVEL_KEY, travelKey);
    Firebase activeTravelRef = new Firebase(Utils.getFirebaseUserActiveTravelUrl(userUID));
    activeTravelRef.setValue(map);

    ((BaseActivity) context).enableStartTrackingButton(true);
}
 
开发者ID:trigor74,项目名称:travelers-diary,代码行数:21,代码来源:Utils.java

示例4: addTable

import com.firebase.client.Firebase; //导入方法依赖的package包/类
/**
 * Create an object Table in the database
 * @param empty reference for table ("pointer") to the table object
 * @return Firebase object with the reference to the newly created table
 */
public Firebase addTable(){

	Firebase tableRef = root.child("Table");

	ResturantTable table = new ResturantTable();
	Firebase newTableRef = tableRef.push();

	//System.out.println("Creating Table...");
	newTableRef.setValue(table, new Firebase.CompletionListener() {

		@Override
		public void onComplete(FirebaseError arg0, Firebase arg1) {
			//System.out.println("Table created");

		}
	});

	sleep(2);
	table.setRef(newTableRef);
	tableList.put(newTableRef.toString(), table);
	return newTableRef;
}
 
开发者ID:torch2424,项目名称:CECS343JavaResturant,代码行数:28,代码来源:ConnectFirebase.java

示例5: addUserInfoPassword

import com.firebase.client.Firebase; //导入方法依赖的package包/类
public String addUserInfoPassword() {
    //TODO: (Optional) Update for any new fields added to DbUserInfo class
    // set user id
    String uid = mRef.getAuth().getUid();

    // create record
    String profileImageUrl = "Not provided by authData";
    String provider = mRef.getAuth().getProvider();

    EditText nameView = (EditText) mView.findViewById(R.id.register_name);
    String displayName = nameView.getText().toString();

    if(mRef.getAuth().getProviderData().containsKey("profileImageURL")) profileImageUrl = mRef.getAuth().getProviderData().get("profileImageURL").toString();

    // define users
    DbUserInfo newUserInfo = new DbUserInfo(provider, email, profileImageUrl, displayName);
    Firebase pushUser = mRef.child("userInfo/users").push();
    pushUser.setValue(newUserInfo);

    // define userMap
    LoginActivity.populateUserMap(mRef, uid, pushUser.getKey());

    return pushUser.getKey();
}
 
开发者ID:cardenuto,项目名称:FirebaseLogin,代码行数:25,代码来源:LoginRegisterDialog.java

示例6: addUserInfo

import com.firebase.client.Firebase; //导入方法依赖的package包/类
public String addUserInfo(AuthData authData) {
    //TODO: (Optional) Update for any new fields added to DbUserInfo class
    // set user id
    String uid = authData.getUid();

    // create record
    String provider = authData.getProvider();
    String email = getResources().getString(R.string.missing_user_data);
    String profileImageUrl = getResources().getString(R.string.missing_user_data);
    String displayName = getResources().getString(R.string.missing_user_data);

    if(authData.getProviderData().containsKey("email")) email = authData.getProviderData().get("email").toString();
    if(authData.getProviderData().containsKey("profileImageURL")) profileImageUrl = authData.getProviderData().get("profileImageURL").toString();
    if(authData.getProviderData().containsKey("displayName")) displayName = authData.getProviderData().get("displayName").toString();

    // define users
    DbUserInfo newUserInfo = new DbUserInfo(provider, email, profileImageUrl, displayName);
    Firebase pushUser = mRef.child("userInfo/users").push();
    pushUser.setValue(newUserInfo);

    // define userMap
    populateUserMap(mRef, uid, pushUser.getKey());

    return pushUser.getKey();
}
 
开发者ID:cardenuto,项目名称:FirebaseLogin,代码行数:26,代码来源:LoginActivity.java

示例7: handleMessage

import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public boolean handleMessage(Message msg) {
    final Account primaryAccount = Sessions.getPrimaryPhoneAccount(AccountManager.get(getApplicationContext()));
    if (primaryAccount != null) {
        final Firebase firebase = new Firebase(Constants.FIREBASE_USER_URL + Hasher.hash(primaryAccount.name));
        final Firebase message = firebase.child("message");
        message.setValue(etSyncable.getText().toString());
        orderSync();
    }
    return false;
}
 
开发者ID:Sefford,项目名称:BeAuthentic,代码行数:12,代码来源:LoggedActivity.java

示例8: insert

import com.firebase.client.Firebase; //导入方法依赖的package包/类
/**
 * Insert some object in specific repository with random id.
 *
 * @param item Object that you want to insert.
 */
@Override
public T insert(T item) {
    Firebase ref = firebase.push();
    ref.setValue(item);
    item.setId(ref.getKey());
    map.put(ref.getKey(), item);
    return item;
}
 
开发者ID:BlunchDev,项目名称:blunch_android,代码行数:14,代码来源:FirebaseRepository.java

示例9: saveToFirebase

import com.firebase.client.Firebase; //导入方法依赖的package包/类
public static void saveToFirebase(GeoFire geoFire,Firebase db, Tutor tutor, Location location){
    if(location != null) {
        Firebase tutorStore = db.child("tutors").child(tutor.getFullName());
        tutorStore.setValue(tutor);
        geoFire.setLocation(tutor.getFullName(), new GeoLocation(location.getLatitude(), location.getLongitude()));
    }
}
 
开发者ID:StephenVanSon,项目名称:TutorMe,代码行数:8,代码来源:Tutor.java

示例10: touchFirebase

import com.firebase.client.Firebase; //导入方法依赖的package包/类
void touchFirebase(){
        // Write trip to firebase
//        String fbId;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.US);

        Firebase tripsRef = new Firebase("https://dazzling-fire-3233.firebaseio.com/trips-started/"+
                sdf.format(new Date(System.currentTimeMillis())));

        Firebase newPushRef = tripsRef.push();
        newPushRef.setValue(System.currentTimeMillis());
//        fbId = newPushRef.getName();
    }
 
开发者ID:RobertTrebor,项目名称:CycleFrankfurtAndroid,代码行数:13,代码来源:RecordingActivity.java

示例11: addPatient

import com.firebase.client.Firebase; //导入方法依赖的package包/类
/**
 * Method for adding a patient for the doctor
 * @param patientEmail - patient email
 */
public void addPatient(String patientEmail) {
    //Getting doctor id_key
    String doc_key = email.replace(".", "");
    //Getting patient id_key
    String pat_key = patientEmail.replace(".", "");
    Firebase firebase = new Firebase("https://care-connect.firebaseio.com/doctors/"
            + doc_key
            + "/patients/" + pat_key);
    firebase.setValue(pat_key);
    //Assigning doc_key to patient
    Firebase patFirebase = new Firebase("https://care-connect.firebaseio.com/patients/" + pat_key + "/doctor_key");
    patFirebase.setValue(doc_key);
}
 
开发者ID:ursopanda,项目名称:kneeRehabMonitoring,代码行数:18,代码来源:DrawerActivity.java

示例12: addPatient

import com.firebase.client.Firebase; //导入方法依赖的package包/类
private void addPatient(Firebase firebase) {
//            FirebaseHelper fb = new FirebaseHelper();
            Patient patient = new Patient(mName, mSurname, mEmail, mPassword, mGender, mPhoneNumber);
//            fb.newPatient(patient, firebase);
            firebase.setValue(patient);
            patientFirebase.removeEventListener(patientListener);

            Toast.makeText(getBaseContext(), "Registration successful!", Toast.LENGTH_LONG).show();
            Intent intent = new Intent(getBaseContext(), LoginActivity.class);
            startActivity(intent);
        }
 
开发者ID:ursopanda,项目名称:kneeRehabMonitoring,代码行数:12,代码来源:RegisterActivity.java

示例13: addDoctor

import com.firebase.client.Firebase; //导入方法依赖的package包/类
private void addDoctor(Firebase firebase) {
            doctorFirebase.removeEventListener(doctorListener);
//            FirebaseHelper fb = new FirebaseHelper();
            Doctor doctor = new Doctor(mName, mSurname, mEmail, mPassword, mPhoneNumber);
//            fb.newDoctor(doctor, firebase);
            firebase.setValue(doctor);

            Toast.makeText(getBaseContext(), "Registration successful!", Toast.LENGTH_LONG).show();
            Intent intent = new Intent(getBaseContext(), LoginActivity.class);
            startActivity(intent);
        }
 
开发者ID:ursopanda,项目名称:kneeRehabMonitoring,代码行数:12,代码来源:RegisterActivity.java

示例14: clearTable

import com.firebase.client.Firebase; //导入方法依赖的package包/类
/**
 *
 * Set the specific table to the inital state
 * @param table Firebase ref to that table object.
 */
public void clearTable(Firebase table){
	//System.out.println("Clearing Table...");
	table.setValue(new ResturantTable(), new Firebase.CompletionListener() {

		@Override
		public void onComplete(FirebaseError arg0, Firebase arg1) {
			//System.out.println("Table cleared");

		}
	});
	sleep(2);
}
 
开发者ID:torch2424,项目名称:CECS343JavaResturant,代码行数:18,代码来源:ConnectFirebase.java

示例15: addItem

import com.firebase.client.Firebase; //导入方法依赖的package包/类
/**
 * Adds a new item to the list, from the main screen.
 * Called from the View when the Add button is pressed;
 * registered via onClick= so no Listener code
 */
public void addItem(View v) {
	String name = mAddTF.getText().toString();
	if (name.isEmpty()) {
		Toast.makeText(this, "Text required!", Toast.LENGTH_SHORT).show();
		return;
	}

       Log.d(TAG, "addItem: trying to add " + name);

	/* Do the work here! Create a Task... */
	Task t = new Task();
	t.setName(mAddTF.getText().toString());
	t.setPriority(Priority.values()[prioSpinner.getSelectedItemPosition()]);
	t.setModified(System.currentTimeMillis());
	t.setStatus(Status.NEW);

	/* NOW: send it to the cloud... */
       Firebase push = ((ApplicationClass)getApplication()).getDatabase().push();
       push.setValue(t);
       Log.d(TAG, "Local key for pushed Task is " + push.getKey());

       // We don't have to add it to the list: our list listener will get an Event soon...

       // ... but if we get here, it's been fed into Fire so we don't need to keep it.
       mAddTF.setText("");
}
 
开发者ID:IanDarwin,项目名称:TodoAndroidFirebase,代码行数:32,代码来源:TaskListActivity.java


注:本文中的com.firebase.client.Firebase.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。