/**
 * Copyright 2017 FreshPlanet
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.freshplanet.ane.AirPushNotification;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.AsyncTask;

import java.util.HashMap;
import java.util.Map;

public class CreateNotificationTask extends AsyncTask<Void, Void, Boolean>
{

	private Context _context;
	private Map<String, String> _messageData;
	private Bitmap _picture;

	public CreateNotificationTask(Context context, Intent intent)
	{
		super();
		_context = context;
		Map<String, String> messageData = new HashMap<>();
		for (String key: intent.getExtras().keySet()) {
			messageData.put(key, intent.getStringExtra(key));
		}
	}

	@Override
	protected Boolean doInBackground(Void... params)
	{
		// Try to download the picture
		try
		{
			_picture = FCMMessagingService.downloadImage(_context, _messageData);
			return _picture != null;
		}
		catch (Exception e)
		{
			e.printStackTrace();
			return false;
		}
	}

	@Override
	protected void onPostExecute(Boolean downloadSuccess)
	{
		if (_context == null || _messageData == null)
		{
			Extension.logToAIR("Couldn't create push notification: _context or _intent was null (CreateNotificationTask.onPostExecute)");
			return;
		}
		FCMMessagingService.displayMessage(_context, _picture, _messageData);
	}
}

@@ -759,16 +759,67 @@
 yncTask;
+%0Aimport android.os.Bundle;%0Aimport android.util.Log;
 %0A%0Aimport
@@ -1194,24 +1194,23 @@
 ;%0A%09%09
-for (String key:
+Bundle bundle =
  int
@@ -1228,77 +1228,181 @@
 as()
-.keySet()) %7B%0A%09%09%09messageData.put(key, intent.getStringExtra(key));%0A%09%09%7D
+;%0A%09%09for (String key : bundle.keySet())%0A%09%09%7B%0A%09%09%09String convertedToString = %22%22 + bundle.get(key);%0A%09%09%09messageData.put(key, convertedToString);%0A%09%09%7D%0A%0A%09%09_messageData = messageData;
 %0A%09%7D%0A

fix local notifications