我目前正在开发适用于 Android 移动设备的社交媒体应用程序,但我在应用程序的成本效率方面存在问题,尤其是使用 Firebase Storage。因此,我想为 Firebase 实现一个 CDN,它可以缓存视频和图像,最好使用提供可扩展定价的 CDN 服务(Google CDN 提供此价格模型)。我一直在到处搜索如何使用 Firebase Storage 实现 google CDN,但没有找到明确的说明。我怎样才能做到这一点?
google-cloud-storage firebase google-cloud-platform firebase-storage google-cloud-cdn
我对Firebase完全不熟悉并且需要知道如何检查我的写作任务是否成功,因为如果我不这样做,那么MainActivity
启动会让我的Register
进步变得混乱.
这将检查是否Username
已经采取并注册用户,如果不是:
Query usernamequery = myRef.orderByChild("Username").equalTo(Username);
usernamequery.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
if (snapshot.exists()) {
// TODO: handle the case where the data already exists
editText.setError("Username taken!");
return;
}
else {
// TODO: handle the case where the data does not yet exist
myRef.child("Users").child(Username).child("Userid").setValue(user.getUid());
myRef.child("Users").child(Username).child("Username").setValue(Username);
startActivity(maps);
finish();
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
Toast.makeText(Username.this, "Error", Toast.LENGTH_LONG).show();
}
});
Run Code Online (Sandbox Code Playgroud)
但我希望只有在激活时才会触发Intent to Main Activity(地图)
myRef.child("Users").child(Username).child("Userid").setValue(user.getUid());
另一个完成任务并取得成功.
我能做什么?
android firebase firebase-authentication firebase-realtime-database
当我尝试启动我的应用程序时,我的Mainactivity在“ setContentView(R.layout.activity_main);”处的oncreate()方法中引发此错误 。 :
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sanchez.worldgramproject/com.example.sanchez.worldgramproject.Fragments.MainActivity}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class android.support.design.widget.BottomNavigationView
Run Code Online (Sandbox Code Playgroud)
迁移到androidx后出现此错误,经过进一步检查,我注意到Bottomnavigationview类中的import语句已过时(不是androidx格式,而是旧格式)。Bottomnavigationview类文件是只读的,因此我无法对其进行编辑。
摇篮:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.example.sanchez.worldgramproject"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
versionCode 0
versionName "0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
implementation …
Run Code Online (Sandbox Code Playgroud)