Code example for ContextWrapper

Methods: getSharedPreferences

0
	/** 
	 * This method is called when the message is arrived.  
	 * It starts sensing process. 
	 */ 
	public void messageArrived(MqttTopic topic, MqttMessage message) throws Exception {
		SharedPreferences sp=context.getSharedPreferences("snmbData",0);
		if(sp.getBoolean("sensing", false)==false){
			Log.d(TAG, "Found a new update");
			Editor ed=sp.edit();
			ed.putBoolean("sensing", true);
			ed.commit();
			new StartPullSensors(context).StartSensing();
		} 
		if(message.toString().startsWith("0")){
			new SocialNetworkListenerManager().fireUpdate("FACEBOOK", message.toString());
		}else{ 
			new SocialNetworkListenerManager().fireUpdate("TWITTER", message.toString());
		} 
	} 
 
	public void deliveryComplete(MqttDeliveryToken token) {