Java tutorial
//package com.java2s; /** * Copyright 2012-2014 Quantcast Corp. * * This software is licensed under the Quantcast Mobile App Measurement Terms of Service * https://www.quantcast.com/learning-center/quantcast-terms/mobile-app-measurement-tos * (the License?). You may not use this file unless (1) you sign up for an account at * https://www.quantcast.com and click your agreement to the License and (2) are in * compliance with the License. See the License for the specific language governing * permissions and limitations under the License. Unauthorized use of this file constitutes * copyright infringement and violation of law. */ import android.content.Context; import android.content.SharedPreferences; public class Main { private static final String SHARED_PREFERENCES_NAME = "com.quantcast.measurement.service"; private static final String USER_AD_PREF_NAME = "adPref"; static boolean getUserAdPref(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); return sharedPreferences.getBoolean(USER_AD_PREF_NAME, false); } }