 // var oneSignalAppId         =   "6019faf3-5f6d-496a-9b1f-ce0ee6c25e5b";
 //var oneSignalAppId         =   "a73da27b-f760-4f3e-918c-5d7f8caca11e";

// var oneSignalAuthorization  =   "ZWI1NTRiNDQtZWE1Yy00MGY3LTk1MGItYTJjYTA2MDRkOTkz";
//var oneSignalAuthorization  =   "OGE0ZTY1MTItYjVjYy00YjYwLTg3YjEtNzM1Nzk0YTA2MjAw";


	 function oneSignalNotificationSendCall(notification_arr){

	consoleProvider.log('oneSignalNotificationSendCall',notification_arr);

	if(notification_arr !='NA'){

		consoleProvider.log('notification_arr_check iff');

		$.each(notification_arr, function(index, keyValue){

			var player_id_arr=[];

			//alert(keyValue.player_id);

			//alert(keyValue.title);

			player_id_arr.push(keyValue.player_id);

			consoleProvider.log('player_id_arr',player_id_arr);

			if(player_id_arr.length>0){

				var title=keyValue.title;

				var message=keyValue.message;

				var action_json=keyValue.action_json;

				oneSignalNotificationSend(title, message, action_json, player_id_arr)

			}

		});

	}

}

 function oneSignalNotificationSend(title, message, jsonData, player_id_arr){

	console.log('NotificationSend');

	var collapse_id = jsonData.action_id;

	var dataPost = {

		"app_id" : oneSignalAppId,

		"contents":{"en":message},

		"headings":{"en":title},

		//"included_segments":["All"],

		"include_player_ids":player_id_arr,

		"data":{"action_json": jsonData},

		"ios_badgeType":'Increase',

		"ios_badgeCount":1,

		"priority":10,

		"collapse_id":collapse_id,

	};

	console.log('dataPost',dataPost);

	

	$.ajax({

		url: "https://onesignal.com/api/v1/notifications",

		headers: {

		'Authorization':'Basic '+oneSignalAuthorization,

		'Content-Type':'application/json'

		},

		type: "POST",

		data: JSON.stringify(dataPost),

		dataType: "json",

		success: function(data) {

		console.log("success",data);

		},

	

		error: function (xhr, ajaxOptions, thrownError) {

		    

		 console.log( "Request failed: xhr" + JSON.stringify(xhr) );

		 console.log( "Request failed: ajaxOptions" + ajaxOptions );

		 console.log( "Request failed: thrownError" + thrownError );

		}

	});

}

   