实现谷歌Android的分析隐私政策和退出的Andr​​oid应用策略 [英] Implement of Google Analytic Android Privacy Policy And Opt-Out Policy in Android app

查看:233
本文介绍了实现谷歌Android的分析隐私政策和退出的Andr​​oid应用策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了很多,然后才知道如何在你的应用程序实现谷歌分析策略,请看下面的我的回答,我在这里对初学解释最简单方式。

I search a lot then come to know how to implement Google Analytic Policy in your app, Please see my answer below, Here i explained Simplest way for beginner.

推荐答案

有许多不同的方式来编译与谷歌分析政策您的应用程序,下面是我的方式只是知识共享请了票,如果你发现这个有用。

There are many different ways to compile your app with Google analytic policy , below is my way just sharing knowledge Please up-vote if you found this useful.

首先添加以下行到您的Play商店应用说明

为使您的应用程序名好,这个应用程序使用谷歌Analytics(分析)
  匿名跟踪应用程序中使用数据。

To make "Your App Name" better,This application uses Google Analytics to anonymously track usage data within the application.

String.xml

<string name="off">Off</string>
<string name="send_usage_statistics">Send anonymous usage statistics</string>
<string name="send_usage_summary">To make <Your App Name> better,This application uses Google Analytics to anonymously track usage data within the application.</string>

在您的prefrence - XML(prefrence.xml)

<CheckBoxPreference android:key="send_usage"
            android:defaultValue="true"
            android:title="@string/send_usage_statistics"
            android:summaryOn="@string/send_usage_summary"
            android:summaryOff="@string/off"/>

在你的prefrenceActivity.java

private void initGoogleAnalytic(CheckBoxPreference checkBoxPreference){

        checkBoxPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

            @Override
            public boolean onPreferenceClick(Preference preference) {
                CheckBoxPreference swp = (CheckBoxPreference)preference;
                boolean isChecked=swp.isChecked();
                GoogleAnalytics.getInstance(getApplicationContext()).setAppOptOut(isChecked);
               // boolean isd=GoogleAnalytics.getInstance(getApplicationContext()).getAppOptOut();
                return false;
            }
        });
    }

最后调用上述方法

 initGoogleAnalytic((CheckBoxPreference) findPreference("send_usage"));

这篇关于实现谷歌Android的分析隐私政策和退出的Andr​​oid应用策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆