Implement unipush push function by hand

1. Preparation

Create a new demo ready to implement the push function
Insert picture description here

Two, configuration push

Check unipush in the manifest to
Insert picture description here
add push permission to
Insert picture description here
enter the configuration page
Insert picture description here

Before doing so, please confirm that you have real-name authentication
Insert picture description here

Three, configuration information

3.1, get android signature

https://ask.dcloud.net.cn/article/35777

Win10 signatures need to be written to files, and administrator rights are required

Insert picture description here

cd C:\Program Files\Java\jdk1.8.0_181\bin

Enter the bin directory of jdk, you can view it from the system variables.

keytool -genkey -alias android.keystore -keyalg RSA -validity 20000 -keystore test.keystore

Generate a signature named test

Insert picture description here

In this case, just copy the command given by the system and execute it.
Note that administrator rights are required here.
Insert picture description here
After completion, two keystore files will be generated, and the old suffix is ​​a backup file.
Insert picture description here

You can use the following command to view:

keytool -list -v -keystore test.keystore
Enter keystore password: //Enter the password and press Enter

The following format information will be output:

Keystore type: PKCS12    
Keystore provider: SUN    

Your keystore contains 1 entry    

Alias name: test    
Creation date: 2019-10-28    
Entry type: PrivateKeyEntry    
Certificate chain length: 1    
Certificate[1]:    
Owner: CN=Tester, OU=Test, O=Test, L=HD, ST=BJ, C=CN    
Issuer: CN=Tester, OU=Test, O=Test, L=HD, ST=BJ, C=CN    
Serial number: 7dd12840    
Valid from: Fri Jul 26 20:52:56 CST 2019 until: Sun Jul 02 20:52:56 CST 2119    
Certificate fingerprints:    
         MD5:  F9:F6:C8:1F:DB:AB:50:14:7D:6F:2C:4F:CE:E6:0A:A5    
         SHA1: BB:AC:E2:2F:97:3B:18:02:E7:D6:69:A3:7A:28:EF:D2:3F:A3:68:E7    
         SHA256: 24:11:7D:E7:36:12:BC:FE:AF:2A:6A:24:BD:04:4F:2E:33:E5:2D:41:96:5F:50:4D:74:17:7F:4F:E2:55:EB:26    
Signature algorithm name: SHA256withRSA    
Subject Public Key Algorithm: 2048-bit RSA key    
Version: 3

Where SHA1 is required

3.2, configure push information

The package name needs to be remembered

Insert picture description here

Four, monitor push

Use h5+ api for monitoring

http://www.html5plus.org/doc/zh_cn/push.html
Insert picture description here

Five, package execution

Insert picture description here

The package name and alias must be consistent in the front.
Insert picture description here
Wait for the package to be
Insert picture description here
completed and change the package base to
Insert picture description here
run to the device
Insert picture description here

Six, test push

Send a push on the official website
Insert picture description here

Note that you need to open notification permissions

Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/Android_Cob/article/details/106968702