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 ; }
Create a pre - defined payload with a simple alert message a badge and a sound .