Firebase分析,如何使用UserProperty

时间:2016-07-08 16:53:08

标签: android firebase firebase-analytics

我正在尝试制作一个alertDialog:

private FirebaseAnalytics mFirebaseAnalytics; 
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
    askProxAtualiza();
 }

private void askProxAtualiza() {
        final String[] choices = getResources().getStringArray(R.array.tema_items);
        ContextThemeWrapper ctx = new ContextThemeWrapper(this, R.style.Theme_MediaRouter_Light);
        AlertDialog ad = new AlertDialog.Builder(ctx)
                .setCancelable(false)
                .setTitle(R.string.tema_dialog_title)
                .setItems(choices, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        final String tema = choices[which];
                        setUserFavoriteFood(tema);
                    }
                }).create();
        ad.show();
    }
}



private void setUserFavoriteFood(String next_up) {
    Log.d("XXXX", "Tema Favorito: " + next_up);
    mFirebaseAnalytics.setUserProperty("next_up", next_up);
}

然后发生这种情况: http://i.stack.imgur.com/s0IEN.png

依赖关系:

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.firebase:firebase-analytics:9.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.google.android.gms:play-services-ads:9.2.0'
compile 'com.google.android.gms:play-services-identity:9.2.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.firebase:firebase-core:9.0.2'

}

apply plugin: 'com.google.gms.google-services'

我在firebase页面上创建了一个名为next_up的用户属性。 有一天我做了更多。 结果没有显示在firebase页面上!!!:

firebase image 这是正确的方法吗?

1 个答案:

答案 0 :(得分:1)

" next_up"的值目前不会显示next_up的自动建议。但是,当您转到信息中心时,选择添加过滤器 - >用户属性 - > next_up并手动键入值,它应该由具有该用户属性值的用户过滤该报告。