---
schema_version: "1"
id: bc0d1e3db9ed0b940d1f5a11199c2cd391928aefc6aa5eb722e4ab1a1067e915
title: apple(alert, sound, badgeCount, userData)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_Messaging_PushNotificationPayload_apple.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_Messaging_PushNotificationPayload_apple.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: e5e199f9f3c4506e8757904908a4c13cf8434ec1d83b15ea6fddaf342702ad37
description: Helper method that creates a valid Apple payload from the specified arguments.
---
# apple(alert, sound, badgeCount, userData)

Helper method that creates a valid Apple payload from the specified arguments.

## Signature

public static Map<String,Object\> apple(String alert, String sound, Integer badgeCount, Map<String,Object\> userData)

## Parameters

- **alert**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    Notification message to be sent to the mobile client.
- **sound**:
    
    Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")
    
    Name of a sound file to be played as an alert. This sound file should be in the mobile application bundle.
- **badgeCount**:
    
    Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")
    
    Number to display as the badge of the application icon.
- **userData**:
    
    Type: [Map](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_map.htm#apex_methods_system_map "Contains methods for the Map collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type."), Object>
    
    Map of key-value pairs that contains any additional data used to provide context for the notification. For example, it can contain IDs of the records that caused the notification to be sent. The mobile client app can use these IDs to display these records.

## Return Value

Type:[Map](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_map.htm#apex_methods_system_map "Contains methods for the Map collection type.")<[String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type."), Object>

Returns a formatted payload that includes all of the specified arguments.

## Usage

To generate a valid payload, you must provide a value for at least one of the following parameters: alert, sound, badgeCount.

## Example

See the [Push Notification Example](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_push_notification.htm#push_notification_example_code).