Examples of Firebase


Examples of com.firebase.client.Firebase

   
  }
 
  private void populateUsers(){
    String url = "https://signal-app.firebaseio.com/users/";
    Firebase dataRef = new Firebase(url);

    dataRef.addChildEventListener(new ChildEventListener() {
     
      @Override
      public void onChildChanged(DataSnapshot snapshot, String previousChildName) {
      }
View Full Code Here

Examples of com.firebase.client.Firebase

  private long _phoneNumber;
 
  public Sender(long number){
    _phoneNumber = number;
    String fireBaseURL = "https://signal-app.firebaseio.com/users/"+_phoneNumber+"/sent";
    final Firebase ref = new Firebase(fireBaseURL);
    ref.addChildEventListener(new ChildEventListener(){
     
     
      @Override
      public void onCancelled(){
       
      }

      @Override
      public void onChildAdded(DataSnapshot snapshot, String arg1) {
       
        final String messageKey = snapshot.getName();
        GenericTypeIndicator<Map<String, Object>> t = new GenericTypeIndicator<Map<String, Object>>(){};
        final Map<String,Object> message = snapshot.getValue(t);
       
        String findFollowersURL = "https://signal-app.firebaseio.com/users/"+_phoneNumber;
        Firebase followers = new Firebase(findFollowersURL);
       
       
        followers.addChildEventListener(new ChildEventListener(){

          @Override
          public void onCancelled() {           
          }

          @Override
          public void onChildAdded(DataSnapshot snapshot, String arg1) {
            if(snapshot.getName().equals("followers")){
              //System.out.println("Test: "+snapshot.getValue());
              String str = (String) snapshot.getValue();
              List<String> followersList = Arrays.asList(str.split(","));
              Firebase users = new Firebase("https://signal-app.firebaseio.com/users");
              for(String user:followersList){
                users.child(user).child("inbox").child(messageKey).setValue(message);
              }
             
            }
         
           
View Full Code Here

Examples of com.firebase.client.Firebase

    this.users = users;
  }
 
  public void contactSearch(){
    String url = "https://signal-app.firebaseio.com/contact-search/";
    Firebase dataRef = new Firebase(url);

    dataRef.addChildEventListener(new ChildEventListener() {
     
      @Override
      public void onChildChanged(DataSnapshot snapshot, String previousChildName) {
      }
View Full Code Here

Examples of com.firebase.client.Firebase

   
    // with the updated phone numbers, this method updates the
    // entry from the requester.
    private void updateContactSearch(String result, String request){
      String url = "https://signal-app.firebaseio.com/contact-search/";
      Firebase dataRef = new Firebase(url);
     
      dataRef.child(request).setValue(result);
    }
View Full Code Here

Examples of net.thegreshams.firebase4j.service.Firebase

      throw new IllegalArgumentException( "Program-argument 'baseUrl' not found but required" );
    }

   
    // create the firebase
    Firebase firebase = new Firebase( firebase_baseUrl );
   
   
    // "DELETE" (the fb4jDemo-root)
    FirebaseResponse response = firebase.delete();
 

    // "PUT" (test-map into the fb4jDemo-root)
    Map<String, Object> dataMap = new LinkedHashMap<String, Object>();
    dataMap.put( "PUT-root", "This was PUT into the fb4jDemo-root" );
    response = firebase.put( dataMap );
    System.out.println( "\n\nResult of PUT (for the test-PUT to fb4jDemo-root):\n" + response );
    System.out.println("\n");
   
   
    // "GET" (the fb4jDemo-root)
    response = firebase.get();
    System.out.println( "\n\nResult of GET:\n" + response );
    System.out.println("\n");
   
   
    // "PUT" (test-map into a sub-node off of the fb4jDemo-root)
    dataMap = new LinkedHashMap<String, Object>();
    dataMap.put( "Key_1", "This is the first value" );
    dataMap.put( "Key_2", "This is value #2" );
    Map<String, Object> dataMap2 = new LinkedHashMap<String, Object>();
    dataMap2.put( "Sub-Key1", "This is the first sub-value" );
    dataMap.put( "Key_3", dataMap2 );
    response = firebase.put( "test-PUT", dataMap );
    System.out.println( "\n\nResult of PUT (for the test-PUT):\n" + response );
    System.out.println("\n");
   
   
    // "GET" (the test-PUT)
    response = firebase.get( "test-PUT" );
    System.out.println( "\n\nResult of GET (for the test-PUT):\n" + response );
    System.out.println("\n");
   
   
    // "POST" (test-map into a sub-node off of the fb4jDemo-root)
    response = firebase.post( "test-POST", dataMap );
    System.out.println( "\n\nResult of POST (for the test-POST):\n" + response );
    System.out.println("\n");
   
   
    // "DELETE" (it's own test-node)
    dataMap = new LinkedHashMap<String, Object>();
    dataMap.put( "DELETE", "This should not appear; should have been DELETED" );
    response = firebase.put( "test-DELETE", dataMap );
    System.out.println( "\n\nResult of PUT (for the test-DELETE):\n" + response );
    response = firebase.delete( "test-DELETE");
    System.out.println( "\n\nResult of DELETE (for the test-DELETE):\n" + response );
    response = firebase.get( "test-DELETE" );
    System.out.println( "\n\nResult of GET (for the test-DELETE):\n" + response );
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.