console.log('[JS-ERROR] - no database token supplied' + token); 
 }
 
 try { 
   // 
     collectionName = 'platform_logins'; 
   // Query the platform_logins table to find thea match for sIDToUser  
  /// 
   var params = {}; 
   params.criteria = {
 
 console.log('Querying platform_logins looking for the last login of for the user they are sending the message to with the following params'+  JSON.stringify(params)); 
     var oResult = Collection.query(dbId, collectionName, params, token); 
    console.log('Results from Query against platform_logins Table: ' +   JSON.stringify(oResult)); 
     var n = oResult.length; 
     if (oResult[0].sdeviceid === undefined  oResult[0].sdeviceid === ''  n === 0){ 
       console.log('[JS-INFO]- No device ID Found For User: '+ sIDToUser); 
       bCanSend = false; 
       bSent = false; 
     }else{ 
       //read the array looking at position [0]  
       var sDevicePushID = oResult[0].sdeviceid; 
       var sToken = oResult[0].sToken; 
       console.log('[JS-INFO]- the device info found sDevicePushID: '+sDevicePushID);  
       //var messageData = { "message": sMessage, "filter": { "deviceID": sDevicePushID}}; 
       console.log('Message Being sent is:  '+ sMessage); 
 /* 
  Apperyio.PN.send( pushAPIKey, { 
     payload:    { 
        "title": 'PeopleReady', 
         "message": sMessage, 
         "badge": 1 
     }, 
     schedule: { 
         scheduledTime: dbDate(), 
         // Use timeZone or userDeviceTimeZone but not both 
         useDeviceTimeZone:true 
     }, 
    filter: {"deviceID": sDevicePushID}
 
 }); 
 }
 
Code: Select all
 */ 
    var oNotification = PN.send( 
       pushAPIKey, //Push Notification API key 
       { 
         "message": sMessage, 
         "badge": 1 
       }, { 
         "deviceID": sDevicePushID 
       }); 
 } 
nSent++ 
   bSent = true;