Android teaches you how to easily realize the push function of mobile phones, and teach you Mob+MobPush step by step to realize the push function?

建议仔细观看每一个步骤,如果一个步骤没处理好,可能就会让你的这个功能无法实现。相信我一定可以成功的。

The first step: Mob platform account

Because I have already registered for the mob platform and there is no extra mobile phone number, I won't elaborate on it. Registration is relatively simple. The link to the mob platform is attached below:
mob platform link : https://www.mob.com/

Step 2: Configure the MobPush environment on the mob platform

For specific details, please refer to my article:
Detailed explanation of 2020 nanny-style pictures for android mobile number login, teach you step by step to implement Mob+SMSSDK platform?
If I have time, I will provide the realization of QQ sharing and other functions. The push function is fairly simple compared to other functions.

1. Click the product center in the blue circle in the figure below.

Insert picture description here

2. Click to enter now.

Insert picture description here

3. Click Create Application.

Insert picture description here

4. Agree to the privacy service.

Insert picture description here

5. Create an application

Remember that 128px*128px
Insert picture description here
if you don’t know how to set the picture size, you can search the FastStone editor on the Internet. I don’t know where to put his installation package. You can find it online, but the drawing software that comes with the window seems You can also set the size (I am not very sure). Don't talk nonsense, get to the point.
Insert picture description here

6. Click the red circle in the figure below to access the interface.

Insert picture description here

7. ChooseMobPush

Insert picture description here

8. Get your App Keysum App Secret.

注意你的App Key和App Secret等下要使用It is recommended to use your own, because the process is not difficult.
Insert picture description here

9. Click SDK to download.

Insert picture description here

10. Download MobPush

Insert picture description here
保存配置之后,然后点击下载
Insert picture description here
Then it will give a download prompt, because my mobile phone is a Huawei mobile phone, I initially thought that I wanted to get his appid, and I deliberately registered as a Huawei developer (but the process is more troublesome), and then I found out that 不需要appidit can also be used, there are detailed steps later .
Insert picture description here

Step 3: Add MobPush code to the android project

1. Create a new Project or Module ( 记住你的包名,下面会用到(重点)).

Insert picture description here

2. Add the following code to your build.gradle (Project)

记住这里是build.gradle(Project)(Project负责管理这个项目里面所有的Module)而不是build.gradle(Module)。
Add the code as follows: the
Insert picture description here
code is as follows:

classpath "com.mob.sdk:MobSDK:2018.0319.1724"

maven {
    
     url 'https://jitpack.io' }

3. Add the following code to your build.gradle (Module)

记得修改为你自己的apppKey和appSecret
If your code is android studio4, as shown below: The
Insert picture description here
code is as follows:

 id 'com.mob.sdk'
MobSDK {
    
    
    appKey "31fb0826f078e"
    appSecret "45d6afd2cbb8416e7378ca33212c3dfc"
    MobPush {
    
    
    }
}

If you are other versions, the code is as follows:

apply plugin:'com.mob.sdk'
MobSDK {
    
    
    appKey "31fb0826f078e"
    appSecret "45d6afd2cbb8416e7378ca33212c3dfc"
    MobPush {
    
    
    }
}

Step 4: Push configuration

1. Click Push Settings

Insert picture description here

2. New package name: remember to be with you新建Project或者Modue的包名一样

Insert picture description here
Insert picture description here

3. Set your new package name as the default package

Insert picture description here
The effect is as follows:
Insert picture description here

4. Run your project

因为我的手机模拟器出现了点问题,这里我用本机测试,手机模拟器具体能不能实现,你们可以自己去探究一下。
We can see that the operation was successful, as shown below:
Insert picture description here

Step 5: Implement the push function

1. Click Create Push

Insert picture description here

2. Fill in the push information

Insert picture description here
Others remain unchanged, and then click Send now:

3. Push successfully

Insert picture description here
Congratulations, the desired effect has been completed. If you encounter any problems, you can raise them, because after all, I can't consider this situation alone.
功能虽然简单,但是步骤并不少,只要细心肯定是可以实现的。

Guess you like

Origin blog.csdn.net/qq_45137584/article/details/112181719