Calling the jpush API has been described in detail on the official website. I just wrote a small demo for testing!
Register an account on the official website of Aurora push to obtainApplication ID (Ppkey),API
Mastersecret,APK application. Install and run the APK on your mobile phone,
Background test code:
Package COM. zensoftware. test; import CN. jpush. API. errorcodeenum; import CN. jpush. API. jpushclient; import CN. jpush. API. messageresult; public class testpush {jpushclient jpush = new jpushclient (master, appkey); // modify the two parameters for your registered int sendno = 108; // in actual business, it is recommended that sendno be an auto-increment number that can be processed by your own business. String IMEI = "IMEI code of the mobile phone"; string msgtitle = ""; string msgcontent = "this is an example of Aurora push! "; Public int max = integer. max_value; Public int min = max/2; messageresult msgresult = NULL; Public void pushmsg () {msgresult = jpush. sendnotificationwithimei (sendno, IMEI, msgtitle, msgcontent); If (null! = Msgresult) {If (msgresult. geterrcode () = errorcodeenum. noerror. value () {system. out. println ("sent successfully, sendno =" + msgresult. getsendno ();} else {system. out. println ("failed to send, error code =" + msgresult. geterrcode () + ", error message =" + msgresult. geterrmsg () ;}} else {system. out. println ("unable to get data") ;}} public int getrandomsendno () {return (INT) (min + math. random () * (max-min);} public static void main (string [] RGS) {testpush test = new testpush (); test. pushmsg (); system. Out. println ("----- push completed! ");}}
Ensure that the mobile phone network is smooth and the background code is running correctly to see the effect!