Aurora push --- Android Demo, Aurora --- Android demo

Source: Internet
Author: User

Aurora push --- Android Demo, Aurora --- Android demo

For a dry job. for the programmer of. net, it is just like a dog biting a hedgehog and does not know where to start. For the programmer, it is both a challenge and an opportunity, because the knowledge is the same, in addition, in the small series of program life, leave the most precious memories, although later small series are not necessarily engaged in the android industry, in the Code world, there are many kinds of things, some are sweet, some are warm, some are Wan-to-song, and some are endless. In these stories, the only thing we have in common is that a year, a month, or a period of time, I love you very much! Love you-during this internship, Android has brought various surprises to xiaobian.

Next, I would like to share with my friends the Aurora push of these two-day study. I would like to thank Zheng Bo for his patience and guidance. First, let's take a look at what Aurora push is, I just heard the name. Wow, what is this? Listen, there is a low-key luxury, there is connotation, also Aurora push? Is light needed? Xiao Bian once again, ke, the so-called Aurora push is an open to ordinary developers, free third-party message PUSH Service. Then I will share with my friends how to implement the Aurora push function.

Step 1: After creating an account and entering Aurora push, the application creation interface is displayed first. Enter the name of your application and the Android package name. Create an application on the Portal and enter the corresponding application name and package name, note that the package name must be the same as the name in the project, as shown in:

Step 2: click "Download Application Example" and the partner will download a. zip compressed file. After decompression, a directory with the same name is displayed. This directory contains all the files in an Android project. You can download the official Demo for reference. We need to use the package file in the official Demo, as shown in:

Step 3: Create an Android factory in eclipse, and copy the files needed in libs to our demo, as shown in:

Step 4: Let's compile our Demo. Because the mini-Editor first came into contact with Android, the small example of Aurora push on the official website is also very difficult for the mini-editor, with the help of Zheng Bo's friends, Xiao Bian transformed the Demo on the official website. It was a little simple and easy to understand. We started to write code, first, compile the code in MainActivity, as shown in:

package com.example.such;import cn.jpush.android.api.JPushInterface;import android.os.Bundle;import android.app.Activity;import android.view.Menu;public class MainActivity extends Activity {    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        JPushInterface.setDebugMode(true);        JPushInterface.init(this);            }    @Override    public boolean onCreateOptionsMenu(Menu menu) {        // Inflate the menu; this adds items to the action bar if it is present.        getMenuInflater().inflate(R.menu.main, menu);        return true;    }    }

Step 5: Compile the code in AndroidManifest. xml as follows:

<? Xml version = "1.0" encoding = "UTF-8"?> <Manifest xmlns: android = "http://schemas.android.com/apk/res/android" package = "com. example. such "android: versionCode =" 1 "android: versionName =" 1.0 "> <uses-sdk android: minSdkVersion =" 14 "android: targetSdkVersion = "19"/> <permission android: name = "com. example. such. permission. JPUSH_MESSAGE "android: protectionLevel =" signature "/> <! -- Required some system-Required permissions, such as network access --> <uses-permission android: name = "com. example. such. 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 Droid: 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. ACCES S_NETWORK_STATE "/> <uses-permission android: name =" android. permission. SYSTEM_ALERT_WINDOW "/> <! -- Optional for location --> <uses-permission android: name = "android. permission. ACCESS_COARSE_LOCATION "/> <uses-permission android: name =" android. permission. ACCESS_WIFI_STATE "/> <uses-permission android: name =" android. permission. CHANGE_WIFI_STATE "/> <uses-permission android: name =" android. permission. ACCESS_FINE_LOCATION "/> <uses-permission android: name =" android. permission. ACCESS_LOCATION_EXTRA_COMM ANDS "/> <uses-permission android: name =" android. permission. CHANGE_NETWORK_STATE "/> <application android: allowBackup =" true "android: icon =" @ drawable/ic_launcher "android: label =" @ string/app_name "android: theme = "@ style/AppTheme"> <activity android: name = "com. example. such. mainActivity "android: label =" @ string/app_name "> <intent-filter> <action android: name =" android. intent. action. MAIN "/> <category and Roid: name = "android. intent. category. LAUNCHER"/> </intent-filter> </activity> <! -- Required. enable it you can get statistics data with channel --> <meta-data android: name = "JPUSH_CHANNEL" android: value = "070581_be2a1d937246352d"/> <meta-data android: name = "JPUSH_APPKEY" android: value = "187f7628001c1503d1_c401"/> <! -- </> Value: AppKey obtained from the developer platform --> <! -- Required SDK core functions --> <activity android: name = "cn. jpush. android. ui. pushActivity "android: theme =" @ android: style/Theme. translucent. noTitleBar "android: configChanges =" orientation | keyboardHidden "> <intent-filter> <action android: name =" cn. jpush. android. ui. pushActivity "/> <category android: name =" android. intent. category. DEFAULT "/> <category android: name =" com. example. such "/> </intent-filter> </activity> <! -- Required SDK core functions --> <service android: name = "cn. jpush. android. service. downloadService "android: enabled =" true "android: exported =" false "> </service> <! -- Required SDK core functions --> <service android: name = "cn. jpush. android. service. pushService "android: enabled =" true "android: exported =" false "> <intent-filter> <action android: name =" cn. jpush. android. intent. REGISTER "/> <action android: name =" cn. jpush. android. intent. REPORT "/> <action android: name =" cn. jpush. android. intent. pushService "/> <action android: name =" cn. jpush. android. intent. PUSH_TIME "/> </intent-filt Er> </service> <! -- Required SDK core functions --> <javaser android: name = "cn. jpush. android. service. pushcycler "android: enabled =" true "> <intent-filter android: priority =" 1000 "> <action android: name =" cn. jpush. android. intent. NOTIFICATION_RECEIVED_PROXY "/> <! -- Required display notification bar --> <category android: name = "com. example. such "/> </intent-filter> <action android: name =" android. intent. action. USER_PRESENT "/> <action android: name =" android.net. conn. CONNECTIVITY_CHANGE "/> </intent-filter> <! -- Optional --> <intent-filter> <action android: name = "android. intent. action. PACKAGE_ADDED "/> <action android: name =" android. intent. action. PACKAGE_REMOVED "/> <data android: scheme =" package "/> </intent-filter> </Cycler> <! -- Required SDK core functions --> <javaser android: name = "cn. jpush. android. service. AlarmReceiver"/> </application> </manifest>
Step 6: After writing the code, we will push the notification on the Portal. If your partner's Android phone is connected to the computer, the JPush Example application can be installed and run. Before proceeding to the next step, make sure that the Network on your cell phone is available. For example, the content to be pushed is as follows:

Step 7: Let's take a look at the miracle of the small cell phone. Let's make a statement. The image below does not have a very high face value. Let's take a look at it:

Note:This blog, Xiao Bian, briefly introduced the knowledge of Aurora push, and then referred to the Demo on the official website. Xiao Bian re-compiled it by himself. For various Android experts, this may not be worth mentioning, but for small editors, happy ing, or that sentence, is both a challenge and an opportunity for small editors because the knowledge is the same. Furthermore, in the life of the mini-editor program, it leaves the most precious memories. Although later mini-Editor may not be engaged in the android industry, there are many kinds of things in the Code world, some are sweet and some are warm, some of these stories have evolved into songs, while others have continued. In these stories, the only thing we have in common is that in a year, a month, or a period of time, we love you very much! Love you-during this internship period, Android has brought all sorts of surprises to xiaobian, and the story is still going on '(* birthday _ birthday *)′......

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

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.