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


Java FirebaseStorage.getReference方法代码示例

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


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

示例1: includesForDeleteFiles

import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
private void includesForDeleteFiles() {
    FirebaseStorage storage = FirebaseStorage.getInstance();

    // [START delete_file]
    // Create a storage reference from our app
    StorageReference storageRef = storage.getReference();

    // Create a reference to the file to delete
    StorageReference desertRef = storageRef.child("images/desert.jpg");

    // Delete the file
    desertRef.delete().addOnSuccessListener(new OnSuccessListener<Void>() {
        @Override
        public void onSuccess(Void aVoid) {
            // File deleted successfully
        }
    }).addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception exception) {
            // Uh-oh, an error occurred!
        }
    });
    // [END delete_file]
}
 
开发者ID:firebase,项目名称:snippets-android,代码行数:25,代码来源:StorageActivity.java

示例2: includesForMetadata_delete

import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
private void includesForMetadata_delete() {
    FirebaseStorage storage = FirebaseStorage.getInstance();
    StorageReference storageRef = storage.getReference();
    StorageReference forestRef = storageRef.child("images/forest.jpg");

    // [START delete_file_metadata]
    // Create file metadata with property to delete
    StorageMetadata metadata = new StorageMetadata.Builder()
            .setContentType(null)
            .build();

    // Delete the metadata property
    forestRef.updateMetadata(metadata)
            .addOnSuccessListener(new OnSuccessListener<StorageMetadata>() {
                @Override
                public void onSuccess(StorageMetadata storageMetadata) {
                    // metadata.contentType should be null
                }
            })
            .addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception exception) {
                    // Uh-oh, an error occurred!
                }
            });
    // [END delete_file_metadata]
}
 
开发者ID:firebase,项目名称:snippets-android,代码行数:28,代码来源:StorageActivity.java

示例3: storageReference

import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Provides
@Singleton
@Named(NAME_ROOT_STORAGE)
static StorageReference storageReference(FirebaseStorage firebaseStorage) {
    return firebaseStorage.getReference();
}
 
开发者ID:Frank1234,项目名称:FireBaseTest,代码行数:7,代码来源:ApplicationModule.java

示例4: onCreate

import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pdf_selector);
    checkconnection();
    Intent j = getIntent();
    u = j.getStringExtra("URI");
    t = j.getStringExtra("CAT");
    uri = t + "/" + u + ".pdf";
    pdfview = (PDFView) findViewById(R.id.pdfview);
    File file = new File(Environment.getExternalStorageDirectory().toString() + "/College Doc/"+t+"/" + u + ".pdf");
    if (file.exists()) {

        pdfview.fromFile(file).load();
    }
    else if(!running)
    {
        int su=0;
        Toast.makeText(PdfSelector.this, "No Internet... Downloading not possible", Toast.LENGTH_SHORT).show();
        Intent i = new Intent(PdfSelector.this, Subjects.class);
        i.putExtra ("SU" ,su);
        startActivity(i);
        finish();
    }
    else {
            check=false;
        FirebaseStorage storage = FirebaseStorage.getInstance();
        StorageReference storageRef = storage.getReference();
        final StorageReference pdfdownload = storageRef.child(uri);
        pdfdownload.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
            @Override
            public void onSuccess(Uri uric) {
                // Got the download URL for 'users/me/profile.png'
                pdfdownload.getFile(uric);
                //checkconnection();
                //pdfview.loadPages();
                //temp = (TextView) findViewById(R.id.temp);
                //temp.setText(uric.toString());
                Uri ur = Uri.parse(uric.toString());
                file_url = uric.toString();
                new DownloadFileFromURL().execute(file_url);
                // startActivity(new Intent(PdfSelector.this,Topics.class));
        /*Intent webIntent = new Intent(Intent.ACTION_VIEW, ur);
        if (webIntent.resolveActivity(getPackageManager()) != null){
            startActivity(webIntent);
        }*/

            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception exception) {
                // Handle any errors
                //startActivity(new Intent(PdfSelector.this,Subjects.class));
                check=true;
                if(running)
                    Toast.makeText(PdfSelector.this, "File Not Exist", Toast.LENGTH_SHORT).show();
                else
                    Toast.makeText(PdfSelector.this, "downloading failed", Toast.LENGTH_SHORT).show();
                checkconnection();
                finish();
            }
        });
    }
}
 
开发者ID:Shobhit-pandey,项目名称:CollegeDoc,代码行数:65,代码来源:PdfSelector.java

示例5: FirebaseStorageServiceImpl

import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
public FirebaseStorageServiceImpl(Context context) {
    FirebaseStorage storage = FirebaseStorage.getInstance("gs://wisebite-f7a53.appspot.com");
    this.reference = storage.getReference();
    this.userService = ServiceFactory.getUserService(context);
}
 
开发者ID:Wisebite,项目名称:wisebite_android,代码行数:6,代码来源:FirebaseStorageServiceImpl.java

示例6: includesForCreateReference

import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
private void includesForCreateReference() {
    FirebaseStorage storage = FirebaseStorage.getInstance();

    // ## Create a Reference

    // [START create_storage_reference]
    // Create a storage reference from our app
    StorageReference storageRef = storage.getReference();
    // [END create_storage_reference]

    // [START create_child_reference]
    // Create a child reference
    // imagesRef now points to "images"
    StorageReference imagesRef = storageRef.child("images");

    // Child references can also take paths
    // spaceRef now points to "images/space.jpg
    // imagesRef still points to "images"
    StorageReference spaceRef = storageRef.child("images/space.jpg");
    // [END create_child_reference]

    // ## Navigate with References

    // [START navigate_references]
    // getParent allows us to move our reference to a parent node
    // imagesRef now points to 'images'
    imagesRef = spaceRef.getParent();

    // getRoot allows us to move all the way back to the top of our bucket
    // rootRef now points to the root
    StorageReference rootRef = spaceRef.getRoot();
    // [END navigate_references]

    // [START chain_navigation]
    // References can be chained together multiple times
    // earthRef points to 'images/earth.jpg'
    StorageReference earthRef = spaceRef.getParent().child("earth.jpg");

    // nullRef is null, since the parent of root is null
    StorageReference nullRef = spaceRef.getRoot().getParent();
    // [END chain_navigation]

    // ## Reference Properties

    // [START reference_properties]
    // Reference's path is: "images/space.jpg"
    // This is analogous to a file path on disk
    spaceRef.getPath();

    // Reference's name is the last segment of the full path: "space.jpg"
    // This is analogous to the file name
    spaceRef.getName();

    // Reference's bucket is the name of the storage bucket that the files are stored in
    spaceRef.getBucket();
    // [END reference_properties]

    // ## Full Example

    // [START reference_full_example]
    // Points to the root reference
    storageRef = storage.getReference();

    // Points to "images"
    imagesRef = storageRef.child("images");

    // Points to "images/space.jpg"
    // Note that you can use variables to create child values
    String fileName = "space.jpg";
    spaceRef = imagesRef.child(fileName);

    // File path is "images/space.jpg"
    String path = spaceRef.getPath();

    // File name is "space.jpg"
    String name = spaceRef.getName();

    // Points to "images"
    imagesRef = spaceRef.getParent();
    // [END reference_full_example]
}
 
开发者ID:firebase,项目名称:snippets-android,代码行数:82,代码来源:StorageActivity.java

示例7: FirebaseStorageService

import com.google.firebase.storage.FirebaseStorage; //导入方法依赖的package包/类
public FirebaseStorageService(FirebaseStorage firebaseStorage, FirebaseObservableListeners firebaseObservableListeners) {
    this.firebaseStorage = firebaseStorage.getReference();
    this.firebaseObservableListeners = firebaseObservableListeners;
}
 
开发者ID:marcovann,项目名称:Firebase-Chat-Demo,代码行数:5,代码来源:FirebaseStorageService.java


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