Our team has been a loyal user of push push, the recent launch of a new product "image of the user portrait", just very fit our business needs, so we also tried a bit. Overall the effect is good, this article will introduce you how to quickly integrate from scratch like the Android SDK.
Sign in to your account and create an app to get app ID
1, visit a Push developer center, click Register Now: (You can also enter from a push official website, click on the top right corner "developer Center". Of course, if you have already registered a push-to-send account, you can log in and use it directly.
2. Fill in and register your account according to your personal circumstances
3. Go back to the push Developer Center log in with the registered account in the previous step, and after entering the developer Platform Panel, select image and User Portrait of the left menu bar:
4. After you have entered the image panel, select the new app in the upper right corner to add the app:
5, fill in the application information, tick Android, click Submit New application:
6. After the new application is successful, the page will automatically return to the app list. To find the new app, click Apply configuration:
7, under the configuration information can see the app ID and other information, copy it to save, the subsequent integration will be used to the app ID:
Configure the SDK as a
Like the Android SDK to provide the mainstream Gradle integration method, easy to operate, a few lines of code can be done.
Add Maven library address in the top-level Build.gradle file named after the project name, add a push Maven library address, such as:
Second, configuration dependence
Referencing a library like SDK dependencies in the App/build.gradle file,
In order to get the SDK-initiated broadcast, we also need to manually write a receiver inheritance broadcastreceiver, and configure the Receiver:receiver code in Androidmanifest.xml as follows:
Third, configure the channel: in the App/build.gradle file Android.defaultconfig add manifestplaceholders, such as:
Where your channel is the channel you want to publish.
Iv. Add the rights statement in the Androidmanifest.xml file:
Initializing the SDK
First, it is recommended to invoke the SDK initialization code in the original boot portal (application OnCreate), which is called as follows:
Second, receives the GIUID in receiver, and obtains the user portrait through the Giuid:
The above is I integrated a push user portrait product (image) of the whole process, I hope to help you! If you have other questions, please feel free to communicate in the message area.
A Push user portrait product (image) Android integration practice