{"__v":0,"_id":"587818c8a762bf2500d6b239","category":{"__v":7,"_id":"55f1970339e3e8190068b2b8","pages":["55f1a1e6229b772300779a34","55f1b11b39e3e8190068b2f1","55f1b59b39e3e8190068b2fc","55f1b6215fe76419007dc760","55f1b69539e3e8190068b2fe","55f1b90a5fe76419007dc763","55f1b93ffd98c42300acc643"],"project":"55de06fa57f7b20d0097636b","version":"55de06fa57f7b20d0097636e","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-10T14:43:15.288Z","from_sync":false,"order":2,"slug":"android-sdk","title":"Android SDK"},"project":"55de06fa57f7b20d0097636b","user":"55de06e19db51a0d0064947d","version":{"__v":10,"_id":"55de06fa57f7b20d0097636e","project":"55de06fa57f7b20d0097636b","createdAt":"2015-08-26T18:35:38.642Z","releaseDate":"2015-08-26T18:35:38.642Z","categories":["55de06fb57f7b20d0097636f","55f1962e3936d52d00fb3c8f","55f1970339e3e8190068b2b8","55f1970d229b772300779a1f","55f1971cfd98c42300acc605","55f1d5c7fd98c42300acc69f","563cbfe4260dde0d00c5e9d4","5644cf437f1fff210078e690","57dc1bbd3ed3450e00dc9ea7","58a600a2243dd30f00fd8773"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-13T00:01:12.461Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":999,"body":"Before your application transmits data back to PushSpring, it should inform your users and get consent. For more info see Google's Developer Policy Center: https://play.google.com/about/privacy-security/user-data/. To help bootstrap this process the PushSpring SDK contains a convenience method to facilitate this process. Simply call:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"PushSpring.showServiceAgreementDialog(:::at:::NonNull Activity activity, @Nullable ServiceAgreementAcceptanceListener listener, @Nullable URL privacyPolicyUrl, @Nullable String termsOfService);\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nto display a Dialog similar to the one below:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/b9e1957-Screen_Shot_2017-01-12_at_3.17.11_PM.png\",\n        \"Screen Shot 2017-01-12 at 3.17.11 PM.png\",\n        592,\n        974,\n        \"#f1f1f1\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Optional arguments\",\n  \"body\": \"Notice that not all arguments are required. The @Nullable arguments are intended to help developers tweak the Dialog, not fully configure it. If more control is required, it's recommended that developers manage their own UI.\"\n}\n[/block]\nAn optional ServiceAgreementAcceptanceListener can be used monitor the onAcceptanceClick() and persist the state of user consent. Here is one example:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"@Override\\npublic void onAcceptanceClick() {\\n  final SharedPreferences.Editor editor = getApplicationContext()\\n                        .getSharedPreferences(\\\"YourPrefs\\\", Context.MODE_PRIVATE)\\n                        .edit();\\n  editor.putBoolean(\\\"userConsents\\\", true);\\n  editor.apply();\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nThis flag can be checked in your Activity's onCreate() method to prevent data transmission until the user has acknowledged it.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class MainActivity extends Activity implements ServiceAgreementAcceptanceListener {        \\n\\n...\\n  @Override\\n  protected void onCreate(Bundle savedInstanceState) {\\n    final SharedPreferences preferences = getApplicationContext().getSharedPreferences(\\\"YourPrefs\\\", Context.MODE_PRIVATE);\\n    boolean userAcceptedTOS = preferences.getBoolean(\\\"userConsents\\\", false);\\n\\n    PushSpring.sharedPushSpring().setTransmissionAllowed(userAcceptedTOS);\\n\\n    if (!userAcceptedTOS) {\\n      serviceAgreementDialog = PushSpring.showServiceAgreementDialog(this, this, null, null);\\n    }\\n  }\\n\\n...\\n\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nFor a more in-depth example please see the PushSpringSDKSample project that accompanies the SDK.","excerpt":"Making it easier to meet the Google Play Program Policies","slug":"getting-user-consent-before-profiling","type":"basic","title":"Getting User Consent Before Profiling"}

Getting User Consent Before Profiling

Making it easier to meet the Google Play Program Policies

Before your application transmits data back to PushSpring, it should inform your users and get consent. For more info see Google's Developer Policy Center: https://play.google.com/about/privacy-security/user-data/. To help bootstrap this process the PushSpring SDK contains a convenience method to facilitate this process. Simply call: [block:code] { "codes": [ { "code": "PushSpring.showServiceAgreementDialog(@NonNull Activity activity, @Nullable ServiceAgreementAcceptanceListener listener, @Nullable URL privacyPolicyUrl, @Nullable String termsOfService);", "language": "java" } ] } [/block] to display a Dialog similar to the one below: [block:image] { "images": [ { "image": [ "https://files.readme.io/b9e1957-Screen_Shot_2017-01-12_at_3.17.11_PM.png", "Screen Shot 2017-01-12 at 3.17.11 PM.png", 592, 974, "#f1f1f1" ] } ] } [/block] [block:callout] { "type": "info", "title": "Optional arguments", "body": "Notice that not all arguments are required. The @Nullable arguments are intended to help developers tweak the Dialog, not fully configure it. If more control is required, it's recommended that developers manage their own UI." } [/block] An optional ServiceAgreementAcceptanceListener can be used monitor the onAcceptanceClick() and persist the state of user consent. Here is one example: [block:code] { "codes": [ { "code": "@Override\npublic void onAcceptanceClick() {\n final SharedPreferences.Editor editor = getApplicationContext()\n .getSharedPreferences(\"YourPrefs\", Context.MODE_PRIVATE)\n .edit();\n editor.putBoolean(\"userConsents\", true);\n editor.apply();\n}", "language": "java" } ] } [/block] This flag can be checked in your Activity's onCreate() method to prevent data transmission until the user has acknowledged it. [block:code] { "codes": [ { "code": "public class MainActivity extends Activity implements ServiceAgreementAcceptanceListener { \n\n...\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n final SharedPreferences preferences = getApplicationContext().getSharedPreferences(\"YourPrefs\", Context.MODE_PRIVATE);\n boolean userAcceptedTOS = preferences.getBoolean(\"userConsents\", false);\n\n PushSpring.sharedPushSpring().setTransmissionAllowed(userAcceptedTOS);\n\n if (!userAcceptedTOS) {\n serviceAgreementDialog = PushSpring.showServiceAgreementDialog(this, this, null, null);\n }\n }\n\n...\n\n}", "language": "java" } ] } [/block] For a more in-depth example please see the PushSpringSDKSample project that accompanies the SDK.