Codota Logo
ApnsService.push
Code IndexAdd Codota to your IDE (free)

How to use
push
method
in
com.notnoop.apns.ApnsService

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
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: com.notnoop.apns/apns

  public void run() {
    while (shouldContinue) {
      try {
        ApnsNotification msg = queue.take();
        service.push(msg);
      } catch (InterruptedException e) {
        // ignore
      } catch (NetworkIOException e) {
        // ignore: failed connect...
      } catch (Exception e) {
        // weird if we reached here - something wrong is happening, but we shouldn't stop the service anyway!
        logger.warn("Unexpected message caught... Shouldn't be here", e);
      }
    }
  }
};
origin: org.apache.camel/camel-apns

private void notify(Exchange exchange) throws ApnsException {
  MessageType messageType = getHeaderMessageType(exchange, MessageType.STRING);
  if (messageType == MessageType.APNS_NOTIFICATION) {
    ApnsNotification apnsNotification = exchange.getIn().getBody(ApnsNotification.class);
    getEndpoint().getApnsService().push(apnsNotification);
  } else {
    constructNotificationAndNotify(exchange, messageType);
  }
}
origin: org.apache.camel/camel-apns

private void constructNotificationAndNotify(Exchange exchange, MessageType messageType) {
  String payload;
  Collection<String> tokens;
  if (isTokensConfiguredUsingUri()) {
    if (hasTokensHeader(exchange)) {
      throw new IllegalArgumentException("Tokens already configured on endpoint " + ApnsConstants.HEADER_TOKENS);
    }
    tokens = new ArrayList<>(tokenList);
  } else {
    String tokensHeader = getHeaderTokens(exchange);
    tokens = extractTokensFromString(tokensHeader);
  }
  if (messageType == MessageType.STRING) {
    String message = exchange.getIn().getBody(String.class);
    payload = APNS.newPayload().alertBody(message).build();
  } else {
    String message = exchange.getIn().getBody(String.class);
    payload = message;
  }
  Date expiry = exchange.getIn().getHeader(ApnsConstants.HEADER_EXPIRY, Date.class);
  if (expiry != null) {
    getEndpoint().getApnsService().push(tokens, payload, expiry);
  } else {
    getEndpoint().getApnsService().push(tokens, payload);
  }
}
origin: signalapp/PushServer

public void sendMessage(ApnMessage message)
  throws TransientPushFailureException
{
 try {
  redisSet(message.getApnId(), message.getNumber(), message.getDeviceId());
  if (message.isVoip()) {
   voipApnService.push(message.getApnId(), message.getMessage(), new Date(message.getExpirationTime()));
   voipMeter.mark();
  } else {
   pushApnService.push(message.getApnId(), message.getMessage(), new Date(message.getExpirationTime()));
   pushMeter.mark();
  }
 } catch (NetworkIOException nioe) {
  logger.warn("Network Error", nioe);
  failureMeter.mark();
  throw new TransientPushFailureException(nioe);
 }
}
com.notnoop.apnsApnsServicepush

Javadoc

Sends the provided notification message to the desired destination.

Popular methods of ApnsService

  • getInactiveDevices
    Returns the list of devices that reported failed-delivery attempts to the Apple Feedback services. T
  • start
    Starts the service. The underlying implementation may prepare its connections or datastructures to b
  • stop
    Stops the service and frees any allocated resources it created for this service. The underlying impl
  • testConnection
    Test that the service is setup properly and the Apple servers are reachable.

Popular in Java

  • Updating database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • setContentView (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now