List of usage examples for android.preference PreferenceManager setDefaultValues
public static void setDefaultValues(Context context, String sharedPreferencesName, int sharedPreferencesMode, int resId, boolean readAgain)
From source file:com.github.preferencefragment.preference.DefaultValues.java
static SharedPreferences getPrefs(Context context) { PreferenceManager.setDefaultValues(context, PREFS_NAME, MODE_PRIVATE, R.xml.default_values, false); return context.getSharedPreferences(PREFS_NAME, MODE_PRIVATE); }
From source file:fi.hut.soberit.physicalactivity.PhysicalActivityApplication.java
@Override public void onCreate() { Log.d(TAG, "onCreate"); PreferenceManager.setDefaultValues(this, Settings.APP_PREFERENCES_FILE, MODE_PRIVATE, R.xml.preferences, false);/*from ww w . j av a 2 s.c o m*/ final DatabaseHelper databaseHelper = new DatabaseHelper(this); databaseHelper.getWritableDatabase(); databaseHelper.closeDatabases(); super.onCreate(); }
From source file:edu.mit.mobile.android.appupdater.AppUpdateChecker.java
/** * @param context//from w w w . j a v a 2 s . co m * @param versionListUrl URL pointing to a JSON file with the update list. * @param updateListener */ public AppUpdateChecker(Context context, String versionListUrl, OnAppUpdateListener updateListener) { mContext = context; mVersionListUrl = versionListUrl; mUpdateListener = updateListener; try { currentAppVersion = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (final NameNotFoundException e) { Log.e(TAG, "Cannot get version for self! Who am I?! What's going on!? I'm so confused :-("); return; } mPrefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE); // defaults are kept in the preference file for ease of tweaking // TODO put this on a thread somehow PreferenceManager.setDefaultValues(mContext, SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE, R.xml.preferences, false); }
From source file:org.rm3l.ddwrt.mgmt.RouterManagementActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_router_management); //Default values are not set by default //Android bug workaround: http://code.google.com/p/android/issues/detail?id=6641 PreferenceManager.setDefaultValues(this, DDWRTCompanionConstants.DEFAULT_SHARED_PREFERENCES_KEY, Context.MODE_PRIVATE, R.xml.router_management_settings, false); this.dao = getDao(this); mRecyclerView = (RecyclerView) findViewById(R.id.routersListView); // use this setting to improve performance if you know that changes // in content do not change the layout size of the RecyclerView // allows for optimizations if all items are of the same size: mRecyclerView.setHasFixedSize(true); // use a linear layout manager mLayoutManager = new LinearLayoutManager(this); mLayoutManager.scrollToPosition(0);/*from ww w .j a v a 2s . co m*/ mRecyclerView.setLayoutManager(mLayoutManager); // specify an adapter (see also next example) mAdapter = new RouterListRecycleViewAdapter(this, this.dao.getAllRouters()); mRecyclerView.setAdapter(mAdapter); /* * onClickDetection is done in this Activity's onItemTouchListener * with the help of a GestureDetector; * Tip by Ian Lake on G+ in a comment to this post: * https://plus.google.com/+LucasRocha/posts/37U8GWtYxDE */ mRecyclerView.addOnItemTouchListener(this); gestureDetector = new GestureDetectorCompat(this, new RouterManagementViewOnGestureListener()); addNewButton = (ImageButton) findViewById(R.id.router_list_add); addNewButton.setOnClickListener(this); mFeedbackDialog = new SendFeedbackDialog(this).getFeedbackDialog(); //Changelog Popup mChangelogDialog = new ChangeLogParameterized(this); //FIXME Disabled for now, because the listener may not be bound to the right positive button // if (mChangelogDialog.isFirstRun()) { // final AlertDialog clLogDialog = mChangelogDialog.getLogDialog(); // clLogDialog.show(); // if (mAdapter.getItemCount() == 0) { // //Override click on Positive Button, so we can display the 'Add Router' Dialog when user closes the ChangeLog popup // clLogDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // //Call initial onclick listener // mChangelogDialog.handlePositiveButtonClick(); // RouterManagementActivity.this.initOpenAddRouterFormIfNecessary(); // } // }); // } // } else { // initOpenAddRouterFormIfNecessary(); // } initOpenAddRouterFormIfNecessary(); }
From source file:net.lp.hivawareness.v4.HIVAwarenessActivity.java
/** Called when the activity is first created. */ @Override/*from w ww. j a v a2 s . c om*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity); //Save ApplicationContext applicationContext = this.getApplicationContext(); enableStrictMode(); if (DEBUG && mStrictModeAvailable) { StrictModeWrapper.allowThreadDiskWrites();//disables temporarily, reenables below } if (!DEBUG) { //BugSense uncaught exceptions analytics. BugSenseHandler.setup(this, BUGSENSE_API_KEY); } //Enable analytics session. Should be first (at least before any Flurry calls). if (!HIVAwarenessActivity.DEBUG) FlurryAgent.onStartSession(this, HIVAwarenessActivity.FLURRY_API_KEY); if (mBackupManagerAvailable) { mBackupManagerWrapper = new BackupManagerWrapper(this);//TODO: should this be app context? Log.i(TAG, "BackupManager API available."); } else { Log.i(TAG, "BackupManager API not available."); } //Load the default preferences values. Should be done first at every entry into the app. PreferenceManager.setDefaultValues(HIVAwarenessActivity.getAppCtxt(), PREFS, MODE_PRIVATE, R.xml.preferences, false); HIVAwarenessActivity.dataChanged(); //Obtain a connection to the preferences. SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); mGender = Gender.valueOf(prefs.getString(PREFS_GENDER, "male")); String region = prefs.getString(PREFS_REGION, null); if (region == null) { mRegion = null; } caught = prefs.getInt(PREFS_INFECTED, -1); if (caught == -1) { calculateInitial(mRegion == null); } else { } // Check for available NFC Adapter mNfcAdapter = NfcAdapter.getDefaultAdapter(HIVAwarenessActivity.getAppCtxt()); if (mNfcAdapter == null) { Toast.makeText(this, "NFC is not available", Toast.LENGTH_LONG).show(); if (!DEBUG) finish(); } mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { ndef.addDataType("application/net.lp.hivawareness.beam"); } catch (MalformedMimeTypeException e) { throw new RuntimeException("fail", e); } mIntentFiltersArray = new IntentFilter[] { ndef }; mTechListsArray = new String[][] { new String[] { NfcF.class.getName() } }; }
From source file:com.telestax.restcomm_olympus.CallActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set window styles for fullscreen-window size. Needs to be done before // adding content. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); setContentView(R.layout.activity_call); // Initialize UI btnHangup = (ImageButton) findViewById(R.id.button_hangup); btnHangup.setOnClickListener(this); btnAnswer = (ImageButton) findViewById(R.id.button_answer); btnAnswer.setOnClickListener(this); btnAnswerAudio = (ImageButton) findViewById(R.id.button_answer_audio); btnAnswerAudio.setOnClickListener(this); btnMuteAudio = (ImageButton) findViewById(R.id.button_mute_audio); btnMuteAudio.setOnClickListener(this); btnMuteVideo = (ImageButton) findViewById(R.id.button_mute_video); btnMuteVideo.setOnClickListener(this); btnKeypad = (ImageButton) findViewById(R.id.button_keypad); btnKeypad.setOnClickListener(this); lblCall = (TextView) findViewById(R.id.label_call); lblStatus = (TextView) findViewById(R.id.label_status); lblTimer = (TextView) findViewById(R.id.label_timer); alertDialog = new AlertDialog.Builder(CallActivity.this).create(); device = RCClient.listDevices().get(0); PreferenceManager.setDefaultValues(this, "preferences.xml", MODE_PRIVATE, R.xml.preferences, false); prefs = PreferenceManager.getDefaultSharedPreferences(this); // Get Intent parameters. final Intent intent = getIntent(); if (intent.getAction().equals(RCDevice.OUTGOING_CALL)) { btnAnswer.setVisibility(View.INVISIBLE); btnAnswerAudio.setVisibility(View.INVISIBLE); } else {//from ww w.ja v a 2s. com btnAnswer.setVisibility(View.VISIBLE); btnAnswerAudio.setVisibility(View.VISIBLE); } keypadFragment = new KeypadFragment(); lblTimer.setVisibility(View.INVISIBLE); // these might need to be moved to Resume() btnMuteAudio.setVisibility(View.INVISIBLE); btnMuteVideo.setVisibility(View.INVISIBLE); btnKeypad.setVisibility(View.INVISIBLE); activityVisible = true; // open keypad FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(R.id.keypad_fragment_container, keypadFragment); ft.hide(keypadFragment); ft.commit(); //handleCall(intent); }
From source file:org.restcomm.android.olympus.CallActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set window styles for fullscreen-window size. Needs to be done before // adding content. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); setContentView(R.layout.activity_call); // Initialize UI btnHangup = (ImageButton) findViewById(R.id.button_hangup); btnHangup.setOnClickListener(this); btnAnswer = (ImageButton) findViewById(R.id.button_answer); btnAnswer.setOnClickListener(this); btnAnswerAudio = (ImageButton) findViewById(R.id.button_answer_audio); btnAnswerAudio.setOnClickListener(this); btnMuteAudio = (ImageButton) findViewById(R.id.button_mute_audio); btnMuteAudio.setOnClickListener(this); btnMuteVideo = (ImageButton) findViewById(R.id.button_mute_video); btnMuteVideo.setOnClickListener(this); btnKeypad = (ImageButton) findViewById(R.id.button_keypad); btnKeypad.setOnClickListener(this); lblCall = (TextView) findViewById(R.id.label_call); lblStatus = (TextView) findViewById(R.id.label_status); lblTimer = (TextView) findViewById(R.id.label_timer); alertDialog = new AlertDialog.Builder(CallActivity.this, R.style.SimpleAlertStyle).create(); PreferenceManager.setDefaultValues(this, "preferences.xml", MODE_PRIVATE, R.xml.preferences, false); prefs = PreferenceManager.getDefaultSharedPreferences(this); // Get Intent parameters. final Intent intent = getIntent(); if (intent.getAction().equals(RCDevice.ACTION_OUTGOING_CALL)) { btnAnswer.setVisibility(View.INVISIBLE); btnAnswerAudio.setVisibility(View.INVISIBLE); } else {/*from w w w .java2 s. c om*/ btnAnswer.setVisibility(View.VISIBLE); btnAnswerAudio.setVisibility(View.VISIBLE); } keypadFragment = new KeypadFragment(); lblTimer.setVisibility(View.INVISIBLE); // these might need to be moved to Resume() btnMuteAudio.setVisibility(View.INVISIBLE); btnMuteVideo.setVisibility(View.INVISIBLE); btnKeypad.setVisibility(View.INVISIBLE); activityVisible = true; // open keypad FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(R.id.keypad_fragment_container, keypadFragment); ft.hide(keypadFragment); ft.commit(); }
From source file:eu.funceptionapps.convertitall.ui.ConverterInterface.java
@Override public void onCreate(Bundle savedInstanceState) { PreferenceManager.setDefaultValues(this, "eu.djnilse.convertitall_preferences", Context.MODE_PRIVATE, R.xml.settings, false);//from w ww. j a va2 s . c om prefs = PreferenceManager.getDefaultSharedPreferences(this); int recentPageId = Integer.valueOf(prefs.getString(RECENT_PAGE_ID, "0")); // delete history of ShareActionProvider deleteFile("share_history.xml"); InitView.setTheme(prefs, this); super.onCreate(savedInstanceState); setContentView(R.layout.converter_interface); thisContext = this; MainIntent = getIntent(); mainActivity = getParent(); mTitle = mDrawerTitle = getTitle(); mUnitCategories = new ArrayList<String>(); String[] arr = getResources().getStringArray(R.array.unit_categories); Collections.addAll(mUnitCategories, arr); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (EdgeEffectListView) findViewById(R.id.left_drawer); // set a custom shadow that overlays the main content when the drawer // opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // Set the adapter for the list view ArrayAdapter<String> mListAdapter = new ArrayAdapter<String>(this, R.layout.drawer_textview, mUnitCategories); mDrawerList.setAdapter(mListAdapter); // Set the list's click listener mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); // Set up the action bar. final ActionBar actionBar = getSupportActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setIcon(getResources().getDrawable(R.drawable.ic_actionbar_icon)); // enable ActionBar app icon to behave as action to toggle nav drawer getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); int drawerIconId = R.drawable.ic_navigation_drawer; if (InitView.getTheme() == InitView.THEME_HOLO_LIGHT) { drawerIconId = R.drawable.ic_drawer_holo_dark; } // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ drawerIconId, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getSupportActionBar().setTitle(mTitle); supportInvalidateOptionsMenu(); // creates call to // onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(mDrawerTitle); supportInvalidateOptionsMenu(); // creates call to // onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); if (savedInstanceState == null) { selectItem(recentPageId); currentPageId = recentPageId; } if (Converter.CurrencyDatabase.exists()) { try { new LoadCurrenciesDBTask().execute(""); } catch (CursorIndexOutOfBoundsException e) { Converter.CurrencyDatabase.delete(); } } //new UpdateCheckTask().execute(true); }
From source file:com.aimfire.main.MainActivity.java
/** * Override Activity lifecycle method./*from w ww. j a va 2s.c o m*/ */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { /* * if this is initial launch, start the service */ startService(new Intent(this, AimfireService.class)); } PreferenceManager.setDefaultValues(this, getString(R.string.settings_file), MODE_PRIVATE, R.xml.pref_settings, true); /* * check persistence storage, if this is the first time we run, save certain * flags (like features available). check showIntro flag and show intro if * necessary */ checkPreferences(); /* * set up UI */ setContentView(R.layout.activity_main); /* * show overflow button even if we have a physical menu button */ forceOverflowButton(); /* * make a backup if we find old, non-compatible cvr files */ if (mShowIntro) { checkOldCvr(); } /* * Obtain the FirebaseAnalytics instance. */ mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); /* * create directories if not exist */ if (!FileUtils.initStorage()) { Toast.makeText(this, R.string.error_accessing_storage, Toast.LENGTH_LONG).show(); finish(); } mThumbsPagerAdapter = new ThumbsPagerAdapter(getSupportFragmentManager()); mThumbsPager = (ViewPager) findViewById(R.id.thumbs_pager); mThumbsPager.setAdapter(mThumbsPagerAdapter); mThumbsPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between pages, select the // corresponding tab. mTabPosition = position; getSupportActionBar().setSelectedNavigationItem(position); } }); ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mMyMediaTab = bar.newTab(); mMyMediaTab.setText(getResources().getString(R.string.tab_my_media_name)); mMyMediaTab.setTabListener(this); mSharedMediaTab = bar.newTab(); mSharedMediaTab.setText(getResources().getString(R.string.tab_shared_with_me_name)); mSharedMediaTab.setTabListener(this); bar.addTab(mMyMediaTab, TAB_INDEX_MY_MEDIA); bar.addTab(mSharedMediaTab, TAB_INDEX_SHARED_MEDIA); /* * first launch of this activity, "Shared with Me" tab is the default. */ if (savedInstanceState != null) { /* * restore tab position after screen rotation */ mTabPosition = savedInstanceState.getInt(KEY_TAB_POSITION); if (BuildConfig.DEBUG) Log.d(TAG, "onCreate: restored tab position=" + mTabPosition); } else { //mTabPosition = TAB_INDEX_MY_MEDIA; mTabPosition = TAB_INDEX_SHARED_MEDIA; if (BuildConfig.DEBUG) Log.d(TAG, "onCreate: set initial tab position=" + mTabPosition); } mCameraFab = (FloatingActionButton) findViewById(R.id.cameraFAB); mCameraFab.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE); if (!manager.isWifiEnabled()) { /* * if wifi not enabled, no point to continue */ Toast.makeText(getApplicationContext(), R.string.error_wifi_off, Toast.LENGTH_LONG).show(); return; } if (AudioConfigure.getAudioRouting() != AudioConfigure.AUDIO_ROUTING_BUILTIN) { Toast.makeText(getApplicationContext(), R.string.error_headset, Toast.LENGTH_LONG).show(); return; } mFirebaseAnalytics.logEvent(MainConsts.FIREBASE_CUSTOM_EVENT_ACTION_CAMERA, null); /* * initiate discovery request */ mAimfireService.initDemo(true, ActivityCode.CAMCORDER.getValue(), null); Intent intent = new Intent(getApplicationContext(), CamcorderActivity.class); startActivityForResult(intent, ActivityCode.CAMCORDER.getValue()); } }); /* * initializes Aimfire service. if it is already started, bind to it */ mAimfireServiceConn = new AimfireServiceConn(this); /* * binding doesn't happen until later. wait for it to happen in another * thread and do the necessary initialization on it. */ (new Thread(mAimfireServiceInitTask)).start(); /* * display app build time in debug window */ displayVersion(); /* * show introduction with a delay (to allow onCreate init to finish) */ if (mShowIntro) { mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.TUTORIAL_BEGIN, null); Handler mHandler = new Handler(); mHandler.postDelayed(mIntroTask, 1000/*ms*/); /* * check if gyroscope is supported (important for Cardboard mode). * only show warning once after fresh install */ checkGyroscope(); } else if (mShowSurvey) { mFirebaseAnalytics.logEvent(MainConsts.FIREBASE_CUSTOM_EVENT_SHOW_SURVEY, null); Handler mHandler = new Handler(); mHandler.postDelayed(mSurveyTask, 1000/*ms*/); } if ((savedInstanceState == null) && isDeviceOnline()) { /* * check if new version is available */ startService(new Intent(this, VersionChecker.class)); /* * download samples in the background (if necessary) */ startService(new Intent(this, SamplesDownloader.class)); /* * notify user if upgrade is available */ if (mUpgradeAvailable) { notifyUpgrade(); } } //(new Thread(mLatencyTestTask)).start(); }
From source file:com.aware.Aware.java
@Override public void onCreate() { super.onCreate(); awareContext = getApplicationContext(); aware_preferences = getSharedPreferences("aware_core_prefs", MODE_PRIVATE); if (aware_preferences.getAll().isEmpty()) { SharedPreferences.Editor editor = aware_preferences.edit(); editor.putInt(PREF_FREQUENCY_WATCHDOG, CONST_FREQUENCY_WATCHDOG); editor.putLong(PREF_LAST_SYNC, 0); editor.putLong(PREF_LAST_UPDATE, 0); editor.commit();/*from w w w . j a v a 2s . c o m*/ } IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_MOUNTED); filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); filter.addDataScheme("file"); awareContext.registerReceiver(storage_BR, filter); filter = new IntentFilter(); filter.addAction(Aware.ACTION_AWARE_CLEAR_DATA); filter.addAction(Aware.ACTION_AWARE_REFRESH); filter.addAction(Aware.ACTION_AWARE_SYNC_DATA); filter.addAction(DownloadManager.ACTION_DOWNLOAD_COMPLETE); awareContext.registerReceiver(aware_BR, filter); alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); awareStatusMonitor = new Intent(getApplicationContext(), Aware.class); repeatingIntent = PendingIntent.getService(getApplicationContext(), 0, awareStatusMonitor, 0); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 1000, aware_preferences.getInt(PREF_FREQUENCY_WATCHDOG, 300) * 1000, repeatingIntent); Intent synchronise = new Intent(Aware.ACTION_AWARE_SYNC_DATA); webserviceUploadIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, synchronise, 0); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { stopSelf(); } else { SharedPreferences prefs = getSharedPreferences(getPackageName(), Context.MODE_PRIVATE); if (prefs.getAll().isEmpty() && Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID).length() == 0) { PreferenceManager.setDefaultValues(getApplicationContext(), getPackageName(), Context.MODE_PRIVATE, R.xml.aware_preferences, true); prefs.edit().commit(); //commit changes } else { PreferenceManager.setDefaultValues(getApplicationContext(), getPackageName(), Context.MODE_PRIVATE, R.xml.aware_preferences, false); } Map<String, ?> defaults = prefs.getAll(); for (Map.Entry<String, ?> entry : defaults.entrySet()) { if (Aware.getSetting(getApplicationContext(), entry.getKey()).length() == 0) { Aware.setSetting(getApplicationContext(), entry.getKey(), entry.getValue()); } } if (Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID).length() == 0) { UUID uuid = UUID.randomUUID(); Aware.setSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID, uuid.toString()); } DEBUG = Aware.getSetting(awareContext, Aware_Preferences.DEBUG_FLAG).equals("true"); TAG = Aware.getSetting(awareContext, Aware_Preferences.DEBUG_TAG).length() > 0 ? Aware.getSetting(awareContext, Aware_Preferences.DEBUG_TAG) : TAG; get_device_info(); if (Aware.DEBUG) Log.d(TAG, "AWARE framework is created!"); //Fixed: only the client application does a ping to AWARE's server if (getPackageName().equals("com.aware")) { new AsyncPing().execute(); } } }