Create a pre-defined payload with a simple alert message, a badge and a sound.

@param message the alert message
@param badge the badge
@param sound the name of the sound
@return a ready-to-send payload
345787
public static PushNotificationPayload combined(String message, int badge, String sound) {
		if (message == null && badge < 0 && sound == null) throw new IllegalArgumentException("Must provide at least one non-null argument");
		PushNotificationPayload payload = complex();
		try {
			if (message != null) payload.addAlert(message);
			if (badge >= 0) payload.addBadge(badge);
			if (sound != null) payload.addSound(sound);
		} catch (JSONException e) {
		}
		return payload;
	}
445365
public OvhSound sounds_POST(String description, String filename) throws IOException {
		String qPath = "/telephony/sounds";
		StringBuilder sb = path(qPath);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "description", description);
		addBody(o, "filename", filename);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhSound.class);
	}
887169
public static UserMessage create (Name speaker, String message)
    {
        return new UserMessage(speaker, null, message, ChatCodes.DEFAULT_MODE);
    }
682020
public void sendCancelledNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
        // Create the message to send
        Message msg = new Message(to);
        // Create a MessageEvent Package and add it to the message
        MessageEvent messageEvent = new MessageEvent();
        messageEvent.setCancelled(true);
        messageEvent.setStanzaId(packetID);
        msg.addExtension(messageEvent);
        // Send the packet
        connection().sendStanza(msg);
    }
1208546
public static AudioFormat getAudioFormat(PayloadType payloadtype) {

        switch (payloadtype.getId()) {
            case 0:
                return new AudioFormat(AudioFormat.ULAW_RTP);
            case 3:
                return new AudioFormat(AudioFormat.GSM_RTP);
            case 4:
                return new AudioFormat(AudioFormat.G723_RTP);
            default:
                return null;
        }

    }
47736
public function addIosNotification($alert=null, $sound=null, $badge=null, $content_available=null, $category=null, $extras=null) {
        $ios = array();

        if (!is_null($alert)) {
            if (!is_string($alert) && !is_array($alert)) {
                throw new InvalidArgumentException("Invalid ios alert value");
            }
            $ios['alert'] = $alert;
        }

        if (!is_null($sound)) {
            if (!is_string($sound)) {
                throw new InvalidArgumentException("Invalid ios sound value");
            }
            if ($sound !== Config::DISABLE_SOUND) {
                $ios['sound'] = $sound;
            }
        } else {
            // 默认sound为''
            $ios['sound'] = '';
        }

        if (!is_null($badge)) {
            if (is_string($badge) && !preg_match("/^[+-]{1}[0-9]{1,3}$/", $badge)) {
                if (!is_int($badge)) {
                    throw new InvalidArgumentException("Invalid ios badge value");
                }
            }
            if ($badge != Config::DISABLE_BADGE) {
                $ios['badge'] = $badge;
            }
        } else {
            // 默认badge为'+1'
            $ios['badge'] = '+1';
        }

        if (!is_null($content_available)) {
            if (!is_bool($content_available)) {
                throw new InvalidArgumentException("Invalid ios content-available value");
            }
            $ios['content-available'] = $content_available;
        }

        if (!is_null($category)) {
            if (!is_string($category)) {
                throw new InvalidArgumentException("Invalid ios category value");
            }
            if (strlen($category)) {
                $ios['category'] = $category;
            }
        }

        if (!is_null($extras)) {
            if (!is_array($extras)) {
                throw new InvalidArgumentException("Invalid ios extras value");
            }
            if (count($extras) > 0) {
                $ios['extras'] = $extras;
            }
        }

        if (count($ios) <= 0) {
            throw new InvalidArgumentException("Invalid iOS notification");
        }

        $this->iosNotification = $ios;
        return $this;
    }
205483
String getPayloadAsString(Message<?> message) {
        if (message.getPayload() instanceof com.consol.citrus.message.Message) {
            return  ((com.consol.citrus.message.Message) message.getPayload()).getPayload(String.class);
        } else {
            return message.getPayload().toString();
        }
    }
1139520
public void porcessMixNotificationArrived(String message, String action) {
    if (!StringUtil.isEmpty(message) && !StringUtil.isEmpty(action)) {
      String channel = getChannel(message);
      if (channel == null || !containsDefaultPushCallback(channel)) {
        channel = AVOSCloud.getApplicationId();
      }

      sendNotificationBroadcast(channel, message, action);
    }
  }
34203
public void processMixPushMessage(String message) {
    if (!StringUtil.isEmpty(message)) {
      String channel = getChannel(message);
      if (channel == null || !containsDefaultPushCallback(channel)) {
        channel = AVOSCloud.getApplicationId();
      }

      String action = getAction(message);
      boolean isSlient = getSilent(message);
      if (action != null) {
        sendBroadcast(channel, message, action);
      } else if (!isSlient) {
        sendNotification(channel, message);
      } else {
        LOGGER.e("ignore push silent message: " + message);
      }
    }
  }
89496
public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception 
	{
        if (!EventUtils.isEmptyOrNull(msgs)) {
    		// Check to validate port
    		int portToUse = getTransportPort(port);
        	
        	DatagramSocket socket = new DatagramSocket();

    		for (int i=0; i<msgs.length; i++) {
    			byte[] msgBytes = getTransportPayload(msgs[i]);
    			send(msgBytes, socket, destination, portToUse);
    		}
           socket.close();
        }
	}
1005625
public boolean sendMessage( Serializable payload ) {
        if (!isOpen() || !multipleMembersInCluster()) {
            return false;
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("{0} SENDING {1} ", toString(), payload);
        }
        try {
            byte[] messageData = toByteArray(payload);
            Message jgMessage = new Message(null, channel.getAddress(), messageData);
            channel.send(jgMessage);
            return true;
        } catch (Exception e) {
            // Something went wrong here
            throw new SystemFailureException(ClusteringI18n.errorSendingMessage.text(clusterName()), e);
        }
    }
968332
function pushListener(event) {
    var jsonString = event.data && event.data.text() ? event.data.text() : null;

    if (!jsonString) {
      console.log('Leanplum: Push received without payload, skipping display.');
      return;
    }

    // noinspection JSCheckFunctionSignatures
    var options = JSON.parse(jsonString);

    /** @namespace options.title The title of the push notification. **/
    /** @namespace options.tag The id of the push notification **/
    if (!options || !options.title || !options.tag) {
      console.log('Leanplum: No options, title or tag/id received, skipping ' + 'display.');
      return;
    }

    // Extract open action url. We only support open url action for now.
    /** @namespace options.data.openAction The openAction of the push notification. **/
    if (options.data && options.data.openAction && options.data.openAction.hasOwnProperty(ACTION_NAME_KEY) && options.data.openAction[ACTION_NAME_KEY] === OPEN_URL_ACTION && options.data.openAction.hasOwnProperty(ARG_URL)) {
      openActions[options.tag] = options.data.openAction[ARG_URL];
    }

    // Extract title and delete from options.
    var title = options.title;
    Reflect.deleteProperty(options, 'title');
    /** @namespace self.registration **/
    /** @namespace self.registration.showNotification **/
    event.waitUntil(self.registration.showNotification(title, options));
  }
694851
public SoundImpl<?> createSound(AssetFileDescriptor fd) {
    PooledSound sound = new PooledSound(pool.load(fd, 1));
    loadingSounds.put(sound.soundId, sound);
    return sound;
  }
1065354
protected void setPayload(String payload) {
        MessageContentBuilder messageContentBuilder = getMessageContentBuilder();

        if (messageContentBuilder instanceof PayloadTemplateMessageBuilder) {
            ((PayloadTemplateMessageBuilder) messageContentBuilder).setPayloadData(payload);
        } else if (messageContentBuilder instanceof StaticMessageContentBuilder) {
            ((StaticMessageContentBuilder) messageContentBuilder).getMessage().setPayload(payload);
        } else {
            throw new CitrusRuntimeException("Unable to set payload on message builder type: " + messageContentBuilder.getClass());
        }
    }
280125
public static <Payload> Message<Payload> create(Payload payload) {
    return new Message<>(payload, HashTreePMap.empty());
  }
1366675
public B signal(String signalName) {
    SignalEventDefinition signalEventDefinition = createSignalEventDefinition(signalName);
    element.getEventDefinitions().add(signalEventDefinition);

    return myself;
  }
791316
def set_push_info(action_loc_key, badge, message, sound, options = {})
      init_push_info
      @push_info.actionLocKey = action_loc_key
      @push_info.badge = badge.to_s
      @push_info.message = message
      @push_info.sound = sound
      @push_info.payload = options[:payload]
      @push_info.locKey = options[:loc_key]
      @push_info.locArgs = options[:loc_args]
      @push_info.launchImage = options[:launch_image]
      # validate method need refactoring.
      # Validate.new.validate(args)
    end