Jpush Aurora Push Detailed

Source: Internet
Author: User
Jpush Aurora Push DetailedTags: jpush aurora push Jpush parsing 2016-10-19 22:26 10458 people read reviews (3) Favorite report category: Android third-party SDK

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Directory (?) [+] a brief introduction to the 1.JPush

Jpush is a professional and free third party cloud push push platform, also known as Aurora Push, in the peer developers of Jpush more favored, haha, not only because it is free, service is also very in place. integration steps for 2.JPush

1. Create a new project and copy your app package name.

2. Log in to the Aurora website, register your users and create your own app using the app package name in the first step.

3. Then download the Aurora SDK and configure the Mainfest in your project according to the Androidmanifest in the SDK

Reference Development Documentation:

① copy Notes as "Required" section (enumeration, all notes Required to be copied into place)

<!--Required Some system-required permissions, such as access to the network, etc.--<uses-permission android:name= "${applicationid}.permission. Jpush_message "/> <uses-permission android:name=" Android.permission.RECEIVE_USER_PRESENT "/> < Uses-permission android:name= "Android.permission.INTERNET"/> <uses-permission android:name= "
Android.permission.WAKE_LOCK "/> <uses-permission android:name=" Android.permission.READ_PHONE_STATE "/> <uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android: Name= "Android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name= "android.permission.WRITE_ SETTINGS "/> <uses-permission android:name=" Android.permission.VIBRATE "/> <uses-permission android:name = "Android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <uses-permission android:name= "Android.permission.ACCESS _network_state "/> <uses-permission android:name=" Android.permission.ACCESS_WIFI_STATE "/> < Uses-permission Android:name= "AndroidOid.permission.SYSTEM_ALERT_WINDOW "/>
 

② replaces the part of the package name with the comment, replacing it with the package name of the current application


You will need to replace your own app package name with ${application}, which is equivalent to filling in the application package name indirectly

③ replace Appkey with the key for registering the app on the portal

<meta-data
    android:name= "Jpush_appkey"
    android:value= "00b190c0d9b4deb0e76445ba"/> <!--  </> values from the developer platform appkey-->
Don't forget this appkey.

④ Configuring Receive

<receiver
    android:name= ". Myreceiver "
    android:enabled=" true ">
    <intent-filter>
        <action android:name=" Cn.jpush.android.intent.REGISTRATION "/>
        <action android:name=" cn.jpush.android.intent.MESSAGE_ RECEIVED "/>
        <action android:name=" Cn.jpush.android.intent.NOTIFICATION_RECEIVED "/>
        <action Android:name= "Cn.jpush.android.intent.NOTIFICATION_OPENED"/>
        <category android:name= " Hongda.zhangxing.com.jpushdemo "/>
    </intent-filter>
</receiver>
Well, manifest's configuration is done.

4. Copy the Libs directory in the SDK to your own project

① Copy the JPUSH-ANDROID-2.2.0.J to the Libs of your project

② Create a folder jnilibs under App-->src-->main, copy the CPU files in the SDK in the Libs directory except the jar package to Jnilibs

5. Push the main code

Add two lines of code to the ①mainactivity.java:

Jpushinterface.setdebugmode (TRUE);//test version is True
jpushinterface.init (this);

② Creating a Receive

public class Myreceiver extends Broadcastreceiver {private static final String TAG = "Jpush";
        @Override public void OnReceive (context context, Intent Intent) {Bundle bundle = Intent.getextras ();

        LOG.D (TAG, "onreceive-" + intent.getaction ()); if (JPushInterface.ACTION_REGISTRATION_ID.equals (Intent.getaction ())) {} else if (Jpushinterface.action_message_r Eceived.equals (Intent.getaction ())) {System.out.println ("a custom message was received:" +bundle.getstring (jpushinterface.extra_mes
            SAGE)); 
            The custom message will not be displayed in the notification bar, the developer must write code to process} else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals (Intent.getaction ())) {
            SYSTEM.OUT.PRINTLN ("Notification received");
            Here you can do some statistics, or do some other work} else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals (Intent.getaction ())) {
            System.out.println ("User clicked to open the notification");  Here you can write your own code to define the behavior of the user after click Intent i = new Intent (context, mainactivity.class);
     Customizing the Open Interface       I.setflags (Intent.flag_activity_new_task);
        Context.startactivity (i);
        } else {log.d (TAG, "unhandled Intent-" + intent.getaction ()); }
    }
}
now it's wide to push. 6. Enter the Aurora control background:
Click Push, send a notification first, edit the content, push (secretly tell you, in the optional option can be set to push the title)Custom caption:
Push effect Diagram:
add: Push success Logcat will have notice, click on the notice, Logcat will also have corresponding hints, then the logic function will need our powerful program ape to develop!
These hints are, of course, customized in receiver:
3.JPush Push Mode1. Push by type by tag:
① Add the following code in the mainactivity:
Set Tag
set<string> sets = new Hashset<string> ();
Sets.add ("Sport");
Sets.add ("Music");
Jpushinterface.settags (This, sets, new Tagaliascallback () {
    @Override public
    void Gotresult (int i, String s, Set<string> set) {
        LOG.D (tag, "Set tag result is" +i);
    }
);
② the tag that will be pushed when the push is pushed

2. By aliases alias push
① Add the following code in the mainactivity:
Set the alias Alia
Jpushinterface.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.