In the above Code, the 1st lines of red text indicates the device token of the iOS device. In actual applications, the device token should be sent to the server by the iOS client over the network. For simplicity, copy and paste the device token of the iOS device here. The code in section 2nd of the above program uses the payload () method of the Push class to send remote Push notifications, the push notification is sent by specifying the export password of the file containing the certificate and private key and the aps_mirror_identity.p12 file. Copy the JavaPNS_2.2.jar, bcprov-jdk15-146.jar, and log4j-1.2.15.jar in the JavaPNS decompression path to the same path of the Java source file, and then compile the Java source file using the following command: Java-encoding UTF-8-cp JavaPNS_2.2.jar PushServer. java // ① The above command is used to compile the PushServer. java file. This command uses the-cp option to temporarily add JavaPNS_2.2.jar to the class loading path. Run PushServer with the following command: Java-cp.: JavaPNS_2.2.jar: bcprov-jdk15-146.jar: log4j-1.2.15.jar PushServer // ② The above command is used to run PushServer and uses the-cp option to temporarily add JavaPNS_2.2.jar, bcprov-jdk15-146.jar, and log4j-1.2.15.jar to the class load path /* Note: If the preceding java commands are executed on UNIX, Linux, and OS X systems, the separators of the JAR packages in the-cp option values are colons; if the preceding java command is executed in Windows, replace the separators of the JAR packages in the-cp option value with semicolons. In addition, do not forget the point (.) at which the-cp option value starts. This point (.) indicates the current path and is used to tell the system to search PushServer files in the current path. */ |