Note: Need to go to the official website to download Jpush-client-3.2.3.jar
/** * Aurora Push Tool Class * @author why * * */@SuppressWarnings ("All") public class Jpushallutil {private final static String AppKey = "" ;p rivate final static String Mastersecret = "";/** * Test method */public static void Main (string[] args) {//Send notification Jsend_notificati On ("0a139889879", "You have a new logistics message _123");} /** * Send notification * @param registrationid Device ID * @param alert push content */public static void Jsend_notification (String Registrationid, String alert) {jpushclient jpushclient = new Jpushclient (Mastersecret, AppKey, 3); Pushpayload payload = send_n (Registrationid, alert); try {pushresult result = Jpushclient.sendpush (payload); SYSTEM.OUT.PRINTLN (result); } catch (Apiconnectionexception e) {System.out.println (e); } catch (Apirequestexception e) {System.out.println (e); SYSTEM.OUT.PRINTLN ("Error response from Jpush server. Should review and fix it. "+ e); System.out.println ("HTTP Status:" + e.getstatus ()); System.out.println ("Error Code:" + E.geterrorcode ()); System.out.println ("Error Message:" + e.geterrormessage ()); System.out.println ("MSG ID:" + e.getmsgid ()); }}public static Pushpayload send_n (string Registrationid, String alert) {return Pushpayload.newbuilder (). Setplatform (P Latform.android_ios ())//Required push platform settings. Setaudience (Audience.registrationid (Registrationid)). Setnotification (Notifica Tion.alert (Alert))/** * If the target platform for the IOS platform needs to be in options * through the apns_production field to develop the push environment. * True to push the production environment, False to push the development environment, or to push the production environment if the * fruit is not specified. SetOptions (Options.newbuilder (). Setapnsproduction (FAL SE). Build ()). build ();}}
Java Aurora Push