// Path: AccSample/app/src/main/java/com/accengage/samples/coffeesample/activities/SampleSettings.java
// @Tag(name = "CoffeeSettings")
// public class SampleSettings extends PreferenceActivity {
// 
// 	private CheckBoxPreference mInappDisplayLock;
// 
// 	@Override
// 	protected void onCreate(Bundle icicle) {
// 		super.onCreate(icicle);
// 
// 		addPreferencesFromResource(R.xml.samplesettings);
// 		setTitle("View : CoffeeSettings");
// 		mInappDisplayLock = (CheckBoxPreference) findPreference("displayLocked");
// 
// 		mInappDisplayLock.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
// 
// 			@Override
// 			public boolean onPreferenceChange(Preference preference, Object newValue) {
// 				if(newValue.toString().equals("true")) {
// 					mInappDisplayLock.setChecked(true);
// 					A4S.get(SampleSettings.this).setInAppDisplayLocked(true);
// 				}
// 				else {
// 					mInappDisplayLock.setChecked(false);
// 					A4S.get(SampleSettings.this).setInAppDisplayLocked(false);
// 				}
// 				return false;
// 			}
// 		});
// 	}
// 	
// 	@Override
// 	protected void onResume() {
// 		super.onResume();
// 		// This activity can be opened through url schema
// 		// Here we are parsing uri for parameters
// 		Intent intent = getIntent();
// 		if (intent != null && intent.getData() != null) {
// 			Uri uri = intent.getData();
// 			//Use datas here and display anything you want relative to these parameters.
// 		}
// 	}
// 
// }


import java.util.Set;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.accengage.samples.coffeesample.activities.SampleSettings;
package com.accengage.samples.coffeesample.receivers;




/**
 * Handle custom parameters as explained on 
 * @see http://docs.accengage.com/display/AND/Android#Android-RetrievingIn-App/Push/InboxandotherCustomParameterswithaBroadcastReceiver
 * In this sample, this class is called as soon as an in-app or push is clicked
 *
 */
public class CustomsParametersReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		Set<String> cats = intent.getCategories();
		Bundle bundle = intent.getExtras();
		if(bundle != null) {
			//Use category in order to know which case to handle
			//You can retrieve the action too in order to know which action has been triggered
			//All actions and categories available can be found inside com.ad4screen.sdk.Constants
			for (String currentCat : cats) {
				if(currentCat.equals(com.ad4screen.sdk.Constants.CATEGORY_PUSH_NOTIFICATIONS)) {
					//Handle push custom parameters
					handlePushCustomParameters(context, bundle);
				}

				if(currentCat.equals(com.ad4screen.sdk.Constants.CATEGORY_INAPP_NOTIFICATIONS)) {
					//Handle in-app custom parameters
				} 
			}
		}
	}

	/**
	 * Handle and trigger an action on some custom parameters
	 * @param context
	 * @param bundle
	 */
	private void handlePushCustomParameters(Context context, Bundle bundle) {
		//Get your key and do what you want
		String myCustomParameter = bundle.getString("my-key");
		//For instance, here we will open Settings activity if my-key value is settings
		if(myCustomParameter != null && myCustomParameter.equals("settings")) {
// Path: AccSample/app/src/main/java/com/accengage/samples/coffeesample/activities/SampleSettings.java
// @Tag(name = "CoffeeSettings")
// public class SampleSettings extends PreferenceActivity {
// 
// 	private CheckBoxPreference mInappDisplayLock;
// 
// 	@Override
// 	protected void onCreate(Bundle icicle) {
// 		super.onCreate(icicle);
// 
// 		addPreferencesFromResource(R.xml.samplesettings);
// 		setTitle("View : CoffeeSettings");
// 		mInappDisplayLock = (CheckBoxPreference) findPreference("displayLocked");
// 
// 		mInappDisplayLock.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
// 
// 			@Override
// 			public boolean onPreferenceChange(Preference preference, Object newValue) {
// 				if(newValue.toString().equals("true")) {
// 					mInappDisplayLock.setChecked(true);
// 					A4S.get(SampleSettings.this).setInAppDisplayLocked(true);
// 				}
// 				else {
// 					mInappDisplayLock.setChecked(false);
// 					A4S.get(SampleSettings.this).setInAppDisplayLocked(false);
// 				}
// 				return false;
// 			}
// 		});
// 	}
// 	
// 	@Override
// 	protected void onResume() {
// 		super.onResume();
// 		// This activity can be opened through url schema
// 		// Here we are parsing uri for parameters
// 		Intent intent = getIntent();
// 		if (intent != null && intent.getData() != null) {
// 			Uri uri = intent.getData();
// 			//Use datas here and display anything you want relative to these parameters.
// 		}
// 	}
// 
// }


// Path: AccSample/app/src/main/java/com/accengage/samples/coffeesample/receivers/CustomsParametersReceiver.java
import java.util.Set;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.accengage.samples.coffeesample.activities.SampleSettings;

package com.accengage.samples.coffeesample.receivers;




/**
 * Handle custom parameters as explained on 
 * @see http://docs.accengage.com/display/AND/Android#Android-RetrievingIn-App/Push/InboxandotherCustomParameterswithaBroadcastReceiver
 * In this sample, this class is called as soon as an in-app or push is clicked
 *
 */
public class CustomsParametersReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		Set<String> cats = intent.getCategories();
		Bundle bundle = intent.getExtras();
		if(bundle != null) {
			//Use category in order to know which case to handle
			//You can retrieve the action too in order to know which action has been triggered
			//All actions and categories available can be found inside com.ad4screen.sdk.Constants
			for (String currentCat : cats) {
				if(currentCat.equals(com.ad4screen.sdk.Constants.CATEGORY_PUSH_NOTIFICATIONS)) {
					//Handle push custom parameters
					handlePushCustomParameters(context, bundle);
				}

				if(currentCat.equals(com.ad4screen.sdk.Constants.CATEGORY_INAPP_NOTIFICATIONS)) {
					//Handle in-app custom parameters
				} 
			}
		}
	}

	/**
	 * Handle and trigger an action on some custom parameters
	 * @param context
	 * @param bundle
	 */
	private void handlePushCustomParameters(Context context, Bundle bundle) {
		//Get your key and do what you want
		String myCustomParameter = bundle.getString("my-key");
		//For instance, here we will open Settings activity if my-key value is settings
		if(myCustomParameter != null && myCustomParameter.equals("settings")) {
			Intent intent = new Intent(context, SampleSettings.class);