Copying Intent Data

There is some confusion from an earlier tutorial I wrote about using urban airships push notifications. On one of the steps I have a function call to copyIntentData. This is a method I wrote. I glossed over it because I was focusing on urban airship configuration and felt that this topic fell outside the scope of tutorial. I have had a few questions posted about what this function entails. This function is very similar to code found on urbanairship’s documentation for logging data found in the intent. Here is the code enjoy!

	 * Method copies the intent extras from the received intent to the intent
	 * that will be dispatched.
	 * @param aReceived
	 * @param aDispatch
	private void copyIntentData(Intent aReceived, Intent aDispatch) {
		Set lKeys = aReceived.getExtras().keySet();
		List lIgnoredKeys = (List) Arrays.asList(
				"collapse_key",// c2dm collapse key
				"from",// c2dm sender
				PushManager.EXTRA_NOTIFICATION_ID,// int id of generated
													// notification
													// (ACTION_PUSH_RECEIVED
													// only)
				PushManager.EXTRA_PUSH_ID);// internal UA push id

		for (String lKey : lKeys) {

			// we don't need to copy all of the details
			if (lIgnoredKeys.contains(lKey)) {

			// the actual copy part
			aDispatch.putExtra(lKey, aReceived.getStringExtra(lKey));

Leave a Reply

Your email address will not be published. Required fields are marked *