List of usage examples for android.content Context getApplicationContext
public abstract Context getApplicationContext();
From source file:com.google.android.apps.dashclock.ExtensionManager.java
private ExtensionManager(Context context) { mApplicationContext = context.getApplicationContext(); mValuesPreferences = mApplicationContext.getSharedPreferences("extension_data", 0); mDefaultPreferences = PreferenceManager.getDefaultSharedPreferences(mApplicationContext); loadInternalActiveExtensionList();//from ww w.j a v a2 s. c o m }
From source file:it.macisamuele.network.WebApplicationClient.java
/** * Enable the persistent cookie store management for the {@code context} * * @param context Context to attach cookie store to *//*from www . j a v a2 s. co m*/ public void setPersistentCookieStore(Context context) { cookieStore = new PersistentCookieStore(context.getApplicationContext()); asyncHttpClient.setCookieStore(cookieStore); if (DEBUG) { Log.d(TAG, "Set PersistentCookieStore"); } }
From source file:pl.openrnd.connection.rest.ConnectionHandler.java
/** * Class constructor.// www . j a va 2 s . c o m * * @param context Application context. * @param connectionConfig ConnectionConfig object with configuration data. */ public ConnectionHandler(Context context, ConnectionConfig connectionConfig) { Log.d(TAG, "ConnectionHandler()"); mApplicationContext = context.getApplicationContext(); mConnectionConfig = connectionConfig; mConnectionLogger = new ConnectionLogger(connectionConfig.getInitialLogsState(), connectionConfig.getInitialLogsSize()); }
From source file:com.vk.sdk.payments.VKPaymentsServerSender.java
private int restoreAnswer(Context ctx) { synchronized (VKPaymentsServerSender.class) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx.getApplicationContext()); return prefs.getInt(KEY_ANSWER, CHECK_USER_INSTALL_ANSWER_UNKNOWN); }/*ww w. j a v a 2s .com*/ }
From source file:com.mobileobservinglog.support.billing.DonationBillingHandler.java
public DonationBillingHandler(Context context, String appKey) { this.context = context.getApplicationContext(); billingKey = appKey; }
From source file:com.docd.purefm.test.CommandLineFileTest.java
@Override protected void runTest() throws Throwable { super.runTest(); // init what application inits final Context context = getInstrumentation().getContext(); final Settings settings = Settings.getInstance(context); com.docd.purefm.Environment.init((Application) context.getApplicationContext()); PFMTextUtils.init(context);// w w w .j a v a 2 s .c om final Shell shell = ShellHolder.getShell(); assertNotNull(shell); // override settings to force our test busybox if (!com.docd.purefm.Environment.hasBusybox()) { throw new RuntimeException("install busybox on a device before running this test"); } settings.setUseCommandLine(true, false); testAgainstJavaIoFile(shell, settings); testFileReading(shell, settings); testFileDeletion(shell, settings); testFileCreation(shell, settings); testMkdir(shell, settings); testMkdirs(shell, settings); }
From source file:com.vk.sdk.payments.VKPaymentsServerSender.java
private void saveAnswer(Context ctx, int value) { synchronized (VKPaymentsServerSender.class) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx.getApplicationContext()); prefs.edit().putInt(KEY_ANSWER, value).apply(); mCheckUserInstallAnswer = value; }// w ww .j a v a 2 s . c o m }
From source file:com.facebook.internal.LikeActionController.java
private synchronized static void ensureApplicationContextExists(Context context) { if (applicationContext == null) { applicationContext = context.getApplicationContext(); }//w ww.j a v a 2 s . co m }
From source file:com.funzio.pure2D.ui.UIManager.java
public void setContext(final Context context) { Log.w(TAG, "setContext(): " + context); mContext = context;// w w w. j av a 2s . co m if (context != null) { mResources = context.getResources(); mPackageName = context.getApplicationContext().getPackageName(); } else { mTextureManager = null; } }
From source file:org.wso2.emm.agent.services.MessageProcessor.java
/** * Local notification message handler./*from www . ja v a2s . c om*/ * * @param context Context of the application. */ public MessageProcessor(Context context) { this.context = context; deviceId = Preference.getString(context, DEVICE_ID_PREFERENCE_KEY); operationProcessor = new OperationProcessor(context.getApplicationContext()); mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); this.devicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); if (deviceId == null) { DeviceInfo deviceInfo = new DeviceInfo(context.getApplicationContext()); deviceId = deviceInfo.getDeviceId(); Preference.putString(context, DEVICE_ID_PREFERENCE_KEY, deviceId); } }