我有一个游戏,我希望每次用户设置新的高分时发送事件,我检查当前分数是否>之前,如果是,我将新的高分发送到firebase.码:
Bundle bundle = new Bundle();
bundle.putLong(FirebaseAnalytics.Param.LEVEL, extras.getInt("score"));
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.LEVEL_UP, bundle);
Run Code Online (Sandbox Code Playgroud)
这就是它在firebase控制台中的样子:图像链接
您可以看到事件按其值分组的方式.
问题是我有4种不同的模式,我想为每个模式捕获高分,所以这就是我尝试的方式:
Bundle bundle = new Bundle();
bundle.putLong(FirebaseAnalytics.Param.LEVEL, extras.getInt("score"));
mFirebaseAnalytics.logEvent("mode4level", bundle);
Run Code Online (Sandbox Code Playgroud)
这就是我在firebase控制台中获得的:图像链接
按价值分组的活动缺失,我只有活动地点,活动人口统计,每个会话的活动.
我该如何解决这个问题,缺少分析的关键部分?谢谢.
我正在尝试将此对象保存在 Room 数据库中,我读到了有关 Typeconverters 的信息,用于转换一个可以存储在数据库中的文件中的复杂对象。我收到此错误: 错误:不确定如何将游标转换为该方法的返回类型 (androidx.lifecycle.LiveData>).---- public abstract androidx.lifecycle.LiveData> queryQuestions(@org.jetbrains.annotations. NotNull() 我的代码基于我发现的将对象转换为房间的类似问题的解决方案,但这对我不起作用。
我的问题课:
@Entity
data class Question(@PrimaryKey var questionId: String = "",
val uid: String,
val name: String,
val photo: String,
val question: String,
val points: Int,
@ServerTimestamp val timestamp: Date? = null,
val options: ArrayList<Option>){
constructor(): this("", "", "", "", "", 0, null, ArrayList())
}
data class Option(val optionText: String,
val correct: Boolean,
var votes: Int = 0,
var usersVoted: ArrayList<UserVoted> = ArrayList()){
constructor(): this("", false /*,0, ArrayList()*/) …Run Code Online (Sandbox Code Playgroud) 问题 1:我知道点击我自己的应用中的真实广告可能会导致我被禁止,但这是否包括展示次数?我开发了应用程序并使用测试广告测试了广告,但现在我想看看它与真实广告的外观(哪些广告出现......)。我该如何测试我是否会因此被禁止?
问题 2:由于我实现了每次向用户展示广告时都会向 Firebase Analytics 发送事件的代码,AdMob 是否会获取有关看到的广告数量的数据?我需要它吗(我应该删除那部分代码)吗?
我设置每个用户每分钟两次展示,但它不起作用。广告每次都会不断展示。

他们在 AdMob 网站上表示:对频次上限的更改(例如将上限从 2 更改为 3)最多可能需要一天才能生效。
但自从我对频次上限进行更改以来已经超过五天了,但它不起作用?以下是我请求广告的方式:
private void requestNewInterstitial() {
AdRequest adRequest = new AdRequest.Builder().addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").build();
mInterstitialAd.loadAd(adRequest);
}
Run Code Online (Sandbox Code Playgroud)
我使用的setTestDevice真实广告不会显示应用程序,因为真实广告的展示可能会让我被禁止。
尝试批量执行多个更新时,有人会遇到类似的问题吗?这是我的功能:
admin.initializeApp();
const db = admin.firestore();
export const unfollowRemoveUser = functions.https.onCall((data, context) => {
const user1id = data.user1
const user2id = data.user2
const user1DocRef = db.collection('users').doc(user1id)
const user2DocRef = db.collection('users').doc(user2id)
const batch = db.batch();
batch.update(user1DocRef, {followingNum : FieldValue.increment(-1)});
batch.update(user2DocRef, {followersNum : FieldValue.increment(-1)});
// Commit the batch
return batch.commit().then(function () {
// ...
});
});
Run Code Online (Sandbox Code Playgroud)
我的功能有问题吗?我这样做就像在批处理写入的文档示例中一样。我收到此错误:
未处理的错误错误:Update()需要单个JavaScript对象或字段/值对的交替列表,其后可以是可选的前提条件。参数\“ dataOrField \”的值不是有效的Firestore文档。无法序列化类型为“ NumericIncrementTransform \”的对象(可在字段followingNum中找到)。Firestore不支持带有自定义原型的JavaScript对象(即通过\“ new \”运算符创建的对象)。\ n位于WriteBatch.update(/ user_code / node_modules / firebase-admin / node_modules / @ google-cloud / firestore /build/src/write-batch.js:367:23)\n在export.unfollowRemoveUser.functions.https.onCall(/user_code/lib/index.js:131:11)\n在/ user_code / node_modules / …
firebase typescript google-cloud-functions google-cloud-firestore
我正在制作一个用户可以互相关注的应用程序。为了决定如何在 firestore 中对其进行建模,我想知道集合大小如何影响查询性能。我首先想到的是这样的:
relationships(coll.)
----{userId_1}(document)
--------following(coll)
------------{someId1}(document)
------------{someId2}(document)
.....
--------followers(coll)
------------{someId5}(document)
------------{someId7}(document)
.....
----{userId_2}(document)
--------following(coll)
------------{someId11}(document)
------------{someId24}(document)
.....
--------followers(coll)
------------{someId56}(document)
------------{someId72}(document)
.....
Run Code Online (Sandbox Code Playgroud)
所以我会有主要的集合关系,然后每个文档将代表一个用户,他将有两个集合 - 关注者和关注者,在这些集合中我将存储带有 id、姓名、电子邮件等数据的文档。然后当 user1 想要时看到他的关注者,我会在“relationships/userId_1/followers”下获取所有文档,如果他想查看他关注的人,我会在“relationships/userId_1/followers”下获取文档
我也想过这样做:
relationships(coll)
----{user5id_user4id}(document)
--------user1:"user5id" (field)
--------user2:"user4id" (field)
.........(other fields)
----{user4_user5}(document)
--------user1:"user4id" (field)
--------user2:"user5id" (field)
.........(other fields)
Run Code Online (Sandbox Code Playgroud)
我将有一个主要集合关系,其中每个文档代表一个以下关系,文档名称将是firstUserId_secondUSerId(意味着firstUserId跟随secondUserId),并且我还有两个字段user1和user2,它们将存储两个用户的id,其中user1跟随user2所以如果我是 {myUserId},我想获取所有我关注的人,我将对关系集合进行查询,其中 user1 = myUserId 如果我想获取所有关注我的人,我将对关系集合进行查询其中 user2 = myUserId 因为每个文档都表示关系 user1 跟随 user2。
所以我的问题是哪种方式查询数据会更有效。在第一种情况下,每个用户都会有他的关注者/关注者的集合,我只会获取文档,在第二种情况下,关系将有许多代表 user1->follows->user2 关系的文档。我知道我将按查询函数返回的文档数量付费,但是如果需要搜索大型集合,那么速度会多快。
我怎么解决这个问题。我无法使此数据绑定有效,我已经尝试了所有方法。Build.gradle(模块应用)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.fusion.alen.ask"
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
androidExtensions {
experimental = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1' …Run Code Online (Sandbox Code Playgroud) android ×5
firebase ×4
admob ×2
kotlin ×2
ads ×1
analytics ×1
android-room ×1
data-binding ×1
events ×1
gson ×1
impressions ×1
typescript ×1