Google 發布商近期更新 政策 針對通過認證的發布商,推出新的通知和同意聲明規定 使用者的精確位置資料 (用於廣告相關用途)。
如果這項政策適用於您,請參考以下程式碼片段,瞭解如何向使用者說明資料共用方式:
Kotlin
protected fun presentConsentOverlay(context: Context) { AlertDialog.Builder(context) .setTitle("Location data") .setMessage("We may use your location, " + "and share it with third parties, " + "for the purposes of personalized advertising, " + "analytics, and attribution. " + "To learn more, visit our privacy policy " + "at https://myapp.com/privacy.") .setNeutralButton("OK") { dialog, which -> dialog.cancel() // TODO: replace the below log statement with code that specifies how // you want to handle the user's acknowledgement. Log.d("MyApp", "Got consent.") } .show() } // To use the above function: presentConsentOverlay(this)
Java
protected void presentConsentOverlay(Context context) { new AlertDialog.Builder(context) .setTitle("Location data") .setMessage("We may use your location, " + "and share it with third parties, " + "for the purposes of personalized advertising, " + "analytics, and attribution. " + "To learn more, visit our privacy policy " + "at https://myapp.com/privacy.") .setNeutralButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); // TODO: replace the below log statement with code that specifies how // you want to handle the user's acknowledgement. Log.d("MyApp", "Got consent."); } }) .show(); } // To use the above method: presentConsentOverlay(this);