Read complete story

JPush Notification implementation for China

JPush is one of the popular and free push notification service provider available in China. Due chinese documentation, there might be chances you might find it difficult. This is not true however.

JPush provide SDK that is easy to use and implement. The only difficulty in implementing the JPush is that there resources are bit scattered or unorganized.[PS: don’t get me wrong]. There are two official domain https://www.jiguang.cn/ and other is jpush.cn.

However jpush.cn now redirect to the former one and according to our client it is used for there internal purposes.

So Let start Implementing JPush as per the docs available on http://jiguang.cn

 

There is a lot of information is provided related to common problems, 3-minute quick demo, integration guide and sdk on http://docs.jpush.cn/display/dev/Index

Let us know consume some ready backed code from JPush developers:

Please use sdk jpush-android-2.1.5.jar or above. Here is the link to download

Setting Manifest

Here are the required permission for JPush

 

Here are the service, receiver and meta info related to JPUSH integration.

 

Initialize JPushInterface in Application class

 

Creating JPushReciever

 

Adding jniLibs

You are required to jniLibs in the project. You can find them in the downloaded sdk check sample image below for reference:

 

Screenshot from 2016-06-21 15:00:19

Location of these library inside your project is

Screenshot from 2016-06-21 14:54:47

 

Add following line in your module/app level gradle for building jniLibs in your project:

 

Pushing notification from JPush panel

Login at https://www.jiguang.cn/ and create application with the proper application Id.

Here is your sample application detail after you successfully create the application

Screenshot from 2016-06-21 15:07:45

 

Application details will contatin a APP_KEY and SECRET_MASTER.  use APP_KEY in the android manifest’s meta data for JPush.

SECRET_KEY is used for server side client for REST implementation.

 

SERVER SIDE IMPLEMENTATION

Here is ready baked code for pushing notification from your PHP script.

 

 

You can refer to https://github.com/jpush/jpush-api-php-client/blob/master/examples/push_example.php for complete example and docs.

 

OTHER USEFUL LINKS AND FURTHER READING

http://community.jiguang.cn/

http://docs.jpush.cn/display/dev/Index

Common Issue:

http://community.jiguang.cn/t/jpushglobal-get-sdk-version-fail-sdk/4222

 

Stay updated !!! Keep coding and commenting

. . .

Comments (3)

Add Your Comment

  • Sunki Baek
    Hi, thanks for the great article, especially when there are not many English articles related on this topic.

    Quick question: I have implemented jPush in my app — but I keep receiving messages even when the app is active and showing on the front. Any advice?

    Thanks!

    • Shubham Agarwal
      Thanks for the appreciation. You should check JPush community and forums. They have abundance of topics related to the topic and also the community including core JPush developer team handles all the issues/queries.
  • css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close