Joke Collection Website - Public benefit messages - Use unipush push in uniapp.

Use unipush push in uniapp.

Uniapp official push document: UniPush User Guide -DCloud Q&A

1 unipush is actually dcloud to help you integrate a pushed sdk into uniapp. The essence is that dcloud helps you make secondary packaging. There is no need to push the sdk of official website integrated App (the server needs to push the sdk of integrated server, but there is a general direction that the server must use transparent templates). You don't need to push to apply for an account, just use the account of dcloud directly.

2 Difference between online message, offline message and transparent message

Online message (push): refers to the state that the App is in the foreground or the App has just retreated to the background but has not been killed in a short time.

Offline message (push): It means that you don't open the App at all, or you kill it when you open the App. Offline message is essentially a long connection at the mobile phone system level realized by mobile phone manufacturers themselves.

Transparent message: also called in-app message or user-defined message, it is essentially a long connection, pushing its own implementation.

1 Huawei mobile phone must be packaged with its own certificate cloud to realize offline push.

2 Xiaomi mobile phone can be pushed offline through cloud packaging or customized debugging base packaging.

3 If oppo and vivo want to push offline, they must be placed in the official app store of oppo and vivo before they can be pushed offline.

Because Huawei mobile phones must use their own certificates to realize the offline push relationship, other Xiaomi mobile phones and ov will package their own certificates.

First of all, the certificate stores some information to show the identity of the developer, similar to the ID card. In order to prove that you are you, it is used to sign the App for the App. A certificate can sign multiple applications.

Self-owned certificate, literally means your own certificate. For uniapp, if your application security is not high or you don't need the push function at all, you can directly choose to use the public * * * test certificate of dcloud for packaging.

As long as you need to push offline messages of Huawei mobile phones, you must make your own certificate. Just do one, and you can do it once and for all.

If you need to support the offline push of Huawei mobile phones, you must make a signing certificate. Under normal circumstances, it is unreasonable for you to do the push function without supporting Huawei, so don't worry so much, just prove it.

Guide to generating signing certificates (. Keystore) for Android platform -DCloud Q&A

/article/35777

In the process of making your own certificate with Windows computer, pay attention to record your own certificate alias and certificate private key password, because it needs to be filled in when packaging.

According to the above document for making certificates, you can get two values in the following form.

Sha 1 needs to be filled in in the background of dcloud developers, and sha256 needs to be filled in the background of Huawei's open platform.

SHA 1:

29: 13:A2:70:8A:97:EE:72: 12:8B:6 1:5A:68:B0:59:43:87:58:AC:42

SHA256:

16: EC: B2: f1:DC:14: BD: 2b: 4e: E2: 4f: 03: 45: 74:17: 84: 83: D4: B7:.

When configuring sha256 in Huawei background, you must click the small blue check mark on the right after copying it into the input box, otherwise it cannot be saved.

There is nothing to say about the configuration of Xiaomi. Create the application directly, and then enable push. Pay attention to the consistency of all package names, copy appid and other related information to the background of dcloud, and the configuration of Xiaomi will be completed.

The following is Huawei:

When Huawei creates an application, the package name should also be unified.

Just choose China as the data storage place, and fill in sha256 obtained from your own certificate here.

If you can't find sha256, maybe you need to click on my project instead of my application.

Then log in to the dcloud developer background.

Note that pkgName here represents the name of the package. Here, please fill in the appid and other information of Huawei Xiaomi and save them.

The Android application signature here is the sha 1 value of your certificate. If your sha 1 value is the same as that written in the following line, congratulations on your mistake. IOS BundleId is the package name of IOs. It is recommended that Android and iOS package names be unified.

After the above configuration is completed, use transparent message to test offline push.

Except for the intention format, you need to pay attention. Just write a string casually.

Intention: # intentaction = android.intentaction.oppotpush; launch flags = 0x 14000000; Component= your package name/io.dcloud.Pandora entry; s . UP-OL-SU = true; S.title= test title; S.content= test content; S. Payload = test; end

Change the word "your bag name" to your bag name, and don't change anything else.

Then you install the packaged App on your mobile phone, and you will receive a push if there is no accident.