Tabnine Logo
com.notnoop.apns
Code IndexAdd Tabnine to your IDE (free)

How to use com.notnoop.apns

Best Java code snippets using com.notnoop.apns (Showing top 20 results out of 315)

origin: stackoverflow.com

 ApnsService service =
   APNS.newService()
   .withCert("/etc/Certificates.p12", "password")
   .withSandboxDestination() // or .withProductionDestination()
   .build();

String payload =
  APNS.newPayload()
  .alertBody("My alert message")
  .badge(45)
  .sound("default")
  .build();

String deviceToken = "f4201f5d8278fe39545349d0868a24a3b60ed732";

log.warn("Sending push notification...");
service.push(deviceToken, payload);
origin: stackoverflow.com

 final InputStream certificate = Thread.currentThread().getContextClassLoader()
    .getResourceAsStream("aps_dev_credentials.p12");
final char[] passwd = {'1','2','3','4'};
final ApnsService apnsService = com.notnoop.apns.APNS.newService()
    .withCert(certificate, new String(passwd))
    .withSandboxDestination().build();
apnsService.testConnection();
origin: stackoverflow.com

ApnsService service = null;
   service = APNS.newService()
       .withCert(certificatePath, certificatePassword)
       .withProductionDestination()
       .asPool(threadCount)
       .build();
   service.start();
origin: com.notnoop.apns/apns

@Override
public String toString() {
  return build();
}
origin: stackoverflow.com

PayloadBuilder payloadBuilder = APNS.newPayload();
   payloadBuilder = payloadBuilder
       .alertBody("yourMessage")
       .sound("default"));
origin: com.notnoop.apns/apns

/**
 * Returns the length of payload bytes once marshaled to bytes
 *
 * @return the length of the payload
 */
public int length() {
  return copy().buildBytes().length;
}
origin: signalapp/PushServer

@Override
public void stop() throws Exception {
 pushApnService.stop();
 voipApnService.stop();
}
origin: com.notnoop.apns/apns

/**
 * Returns a copy of this builder
 *
 * @return a copy of this builder
 */
public PayloadBuilder copy() {
  return new PayloadBuilder(root, aps, customAlert);
}
origin: com.notnoop.apns/apns

/**
 * Construct service which will process notification requests in batch.
 * After each request batch will wait <code>waitTimeInSec (set as 5sec)</code> for more request to come
 * before executing but not more than <code>maxWaitTimeInSec (set as 10sec)</code>
 * 
 * Note: It is not recommended to use pooled connection
 */
public ApnsServiceBuilder asBatched() {
  return asBatched(5, 10);
}

origin: com.notnoop.apns/apns

/**
 * Requests clearing of the badge number next to the application
 * icon.
 *
 * This is an alias to {@code badge(0)}.
 *
 * @return this
 */
public PayloadBuilder clearBadge() {
  return badge(0);
}
origin: com.notnoop.apns/apns

  /**
   * Returns a new APNS Service for sending iPhone notifications
   */
  public static ApnsServiceBuilder newService() {
    return new ApnsServiceBuilder();
  }
}
origin: com.notnoop.apns/apns

/**
 * Specify the reconnection policy for the socket connection.
 *
 * Note: This option has no effect when using non-blocking
 * connections.
 */
public ApnsServiceBuilder withReconnectPolicy(ReconnectPolicy.Provided rp) {
  this.reconnectPolicy = rp.newObject();
  return this;
}
origin: org.apache.camel/camel-apns

private void configureApnsDelegate(ApnsServiceBuilder builder) {
  if (apnsDelegate != null) {
    builder.withDelegate(apnsDelegate);
  }
}
origin: com.notnoop.apns/apns

/**
 * Set the notification view to display an action button.
 *
 * This is an alias to {@code actionKey(null)}
 *
 * @return this
 */
public PayloadBuilder noActionButton() {
  return actionKey(null);
}
origin: com.notnoop.apns/apns

/**
 * Returns the length of the message in bytes as it is encoded on the wire.
 *
 * Apple require the message to be of length 255 bytes or less.
 *
 * @return length of encoded message in bytes
 */
public int length() {
  int length = 1 + 4 + 4 + 2 + deviceToken.length + 2 + payload.length;
  assert marshall().length == length;
  return length;
}
origin: com.notnoop.apns/apns

/**
 * Returns the length of the message in bytes as it is encoded on the wire.
 *
 * Apple require the message to be of length 255 bytes or less.
 *
 * @return length of encoded message in bytes
 */
public int length() {
  int length = 1 + 2 + deviceToken.length + 2 + payload.length;
  assert marshall().length == length;
  return length;
}
origin: com.notnoop.apns/apns

/**
 * Returns true if the payload built so far is larger than
 * the size permitted by Apple (which is 256 bytes).
 *
 * @return true if the result payload is too long
 */
public boolean isTooLong() {
  return length() > Utilities.MAX_PAYLOAD_LENGTH;
}
origin: stackoverflow.com

 PayloadBuilder payload = APNS.newPayload();

// build your payload               

if (payload.isTooLong())
{
  // your payload is too long, a push() will result in the above exception
}
origin: com.notnoop.apns/apns

/**
 * Returns a new Payload builder
 */
public static PayloadBuilder newPayload() {
  return new PayloadBuilder();
}
origin: com.notnoop.apns/apns

  /**
   * @return a new instance of Payload Builder
   */
  public static PayloadBuilder newPayload() {
    return new PayloadBuilder();
  }
}
com.notnoop.apns

Most used classes

  • ApnsService
    Represents the connection and interface to the Apple APNS servers. The service is created by ApnsSer
  • ApnsServiceBuilder
    The class is used to create instances of ApnsService. Note that this class is not synchronized. If m
  • PayloadBuilder
    Represents a builder for constructing Payload requests, as specified by Apple Push Notification Prog
  • APNS
    The main class to interact with the APNS Service. Provides an interface to create the ApnsServiceBui
  • ApnsDelegate
    A delegate that gets notified of the status of notification delivery to the Apple Server. The delega
  • DeliveryError,
  • EnhancedApnsNotification,
  • ReconnectPolicy$Provided,
  • ReconnectPolicy,
  • SimpleApnsNotification,
  • AbstractApnsService,
  • ApnsConnection,
  • ApnsConnectionImpl,
  • ApnsFeedbackConnection,
  • ApnsPooledConnection,
  • ApnsServiceImpl,
  • BatchApnsService,
  • QueuedApnsService,
  • ReconnectPolicies$Always
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now