本文整理汇总了Java中com.aware.Aware.setSetting方法的典型用法代码示例。如果您正苦于以下问题:Java Aware.setSetting方法的具体用法?Java Aware.setSetting怎么用?Java Aware.setSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.aware.Aware
的用法示例。
在下文中一共展示了Aware.setSetting方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSharedPreferenceChanged
import com.aware.Aware; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
Preference preference = (Preference) findPreference(key);
if( preference.getKey().toString().equals(STATUS_PLUGIN_SOS_MOBILE_SENSOR) ) {
boolean is_active = sharedPreferences.getBoolean(key, false);
Aware.setSetting(this, key, is_active);
if( is_active ) {
Aware.startPlugin(getApplicationContext(), getPackageName());
Aware.startPlugin(getApplicationContext(), "com.aware.plugin.google.activity_recognition");
Aware.startPlugin(getApplicationContext(), "com.aware.plugin.ambient_noise");
} else {
Aware.stopPlugin(getApplicationContext(), getPackageName());
Aware.stopPlugin(getApplicationContext(), "com.aware.plugin.google.activity_recognition");
Aware.stopPlugin(getApplicationContext(), "com.aware.plugin.ambient_noise");
}
}
}
示例2: startAwareSensors
import com.aware.Aware; //导入方法依赖的package包/类
public void startAwareSensors(){
Intent aware = new Intent(this, Aware.class);
startService(aware);
//Activate core sensors
Aware.setSetting(getApplicationContext(), Settings.STATUS_PLUGIN_SOS_MOBILE_SENSOR, true);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_SCREEN, true);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_INSTALLATIONS, true);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_APPLICATIONS, true);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_CALLS, true);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_MESSAGES, true);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_ESM, true);
Aware.setSetting(this, Aware_Preferences.DEBUG_FLAG, true);
Intent apply = new Intent(Aware.ACTION_AWARE_REFRESH);
sendBroadcast(apply);
}
示例3: onDestroy
import com.aware.Aware; //导入方法依赖的package包/类
/**
* Code here when add-on is turned off.
*/
@Override
public void onDestroy() {
super.onDestroy();
participantID = null;
//Unregister all observers and receivers
unregisterReceiver(screenListener);
unregisterReceiver(activityListener);
getContentResolver().unregisterContentObserver(multitask_observer);
getContentResolver().unregisterContentObserver(phone_observer);
getContentResolver().unregisterContentObserver(messages_observer);
getContentResolver().unregisterContentObserver(esm_observer);
getContentResolver().unregisterContentObserver(calendar_observer);
getContentResolver().unregisterContentObserver(install_observer);
getContentResolver().unregisterContentObserver(ambient_noise_observer);
//Stop listening to changes in the database(s)
thread_sensor_screen.removeCallbacksAndMessages(null);
thread_sensor_multi.removeCallbacksAndMessages(null);
thread_sensor_activity.removeCallbacksAndMessages(null);
thread_sensor_messages.removeCallbacksAndMessages(null);
thread_sensor_esm.removeCallbacksAndMessages(null);
thread_esm_alarm.removeCallbacksAndMessages(null);
thread_observer_calendar.removeCallbacksAndMessages(null);
thread_sensor_install.removeCallbacksAndMessages(null);
thread_sensor_ambient_noise.removeCallbacksAndMessages(null);
//Stop all threads
if(thread_calendar_alarms.size() != 0){
for(Handler h : thread_calendar_alarms){
h.removeCallbacksAndMessages(null);
}
thread_calendar_alarms.clear();
}
thread_multitasking.interrupt();
thread_activity.interrupt();
thread_messages.interrupt();
thread_phone.interrupt();
thread_esm.interrupt();
thread_calendar.interrupt();
thread_screen.interrupt();
thread_install.interrupt();
thread_cal_alarm.interrupt();
thread_ambient_noise.interrupt();
thread_multitasking = null;
thread_activity = null;
thread_messages = null;
thread_phone = null;
thread_esm = null;
thread_calendar = null;
thread_screen = null;
thread_install = null;
thread_cal_alarm = null;
thread_ambient_noise = null;
//Deactivate the sensors
Aware.setSetting(getApplicationContext(), Settings.STATUS_PLUGIN_SOS_MOBILE_SENSOR, false);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_SCREEN, false);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_INSTALLATIONS, false);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_APPLICATIONS, false);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_CALLS, false);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_MESSAGES, false);
Aware.setSetting(getApplicationContext(), Aware_Preferences.STATUS_ESM, false);
Intent refresh = new Intent(Aware.ACTION_AWARE_REFRESH);
sendBroadcast(refresh);
//Deactivate the plugins
Aware.stopPlugin(this, "com.aware.plugin.google.activity_recognition");
Aware.stopPlugin(this, "com.aware.plugin.ambient_noise");
}