Aurora Push---Android demo

Source: Internet
Author: User

For a Cheng who has been working on. Net. Sudden let small knitting dry Android, that feeling is like small dog bite small hedgehog, do not know from where to start, for small series. It is both a challenge and an opportunity, because knowledge is interlinked. Moreover, in the small part of the process of life, leaving the most precious memories, although not necessarily engaged in the future of the Android industry, code World, very many things, some sweet, some warm, some tactfully into a song. Some stretches, in these stories, the only thing we have in common is that one year, one month, some placid day. I loved you very much before. Love You-the days of this internship, Android brought to the small series of various surprises.

Next. Small make up with the small partners to share the two days of small research on the aurora push. Thanks again for the patience and guidance of Zheng Children, first of all, let's look at what is the Aurora push. I just heard the name, whoa, what's this? Listen to the low-key luxury has connotation, but also the aurora push? Is it going to use the light? Small series and the Earth Turtle, cough, so-called Aurora Push is an open for ordinary developers. Free third-party message push service. Then small to share with the small partners. How to achieve the Aurora push this small function.

The first step is to create an account to enter the aurora after push. The first thing to show is the interface to create the app. Fill in the name of your app, and the Android package name this two top will be able to create the app on the portal. Fill in the corresponding app name, and the app's package name, and note that the package name here is consistent with the name in project. For example, as seen in:

The second step. After clicking "Download App example". The small partner is downloaded to a. zip archive.

After decompression, you will see a folder with the same name. This folder is all the files in an Android project. The small partners can download the official demo to participate in the test, we need to use the official demo package file. For example, as seen in:

In the third step, we create an Android factory in Eclipse and copy the relevant files that are needed in the Libs to our demo, for example, as seen in:

Fourth step. Let's write our demo. Due to the small series of first contact with Android. Official online on the Aurora push sample, for small series. See also very arduous, in Zheng Small partner's help, small part of the official online demo makeover. It's a little bit simpler, lost, solved, and we start writing code. First, let's write the code inside the mainactivity, for example, as seen 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;    }    }

Fifth step. Let's write the code inside the Androidmanifest.xml, as seen in the following:

<?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= "android:targets" dkversion= "/> <permission android:name=" Com.example.such.permission.JPUSH_MESSAGE "Androi D:protectionlevel= "signature"/> <!--Required Some system-required permissions. Visit the network, etc.--<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-p Ermission 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.SYSTEM_ALERT_WINDOW"/> <!--Optional for location--<uses-permiss Ion 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 an Droid:name= "Android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/> <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 android:name=" Android.intent.category.LAUNCHER "/> </intent-filter> </activity> <!--Required. Enable it can get statistics data with channel-to-<meta-data android:name= "Jpush_channel" android:value= "07058465be2a1d937246352d"/> <meta-data android:name= "Jpush_appkey" android:value= "187f7628001c1503d487c401 "/> <!--</> values from the developer platform Appkey--> <!--Required SDK Core Features--<activity a Ndroid:name= "Cn.jpush.android.ui.PushActivity" Android:theme= "@android: Style/theme.translucent.notitlebar" android:configchanges= "Orientation|keyboardhi Dden "> <intent-filter> <action android:name=" Cn.jpush.android.ui.PushActivity "/&gt ; <category android:name= "Android.intent.category.DEFAULT"/> <category android:name= "com.example.su Ch "/> </intent-filter> </activity> <!--Required SDK Core Features-- <service android:name= "Cn.jpush.android.service.DownloadService" android:enabled= "true" Android:exported= "false" > </service> <!--Required SDK core Features--<serv Ice android:name= "Cn.jpush.android.service.PushService" android:enabled= "true" Android:ex Ported= "false" > <intent-filter> <action android:name= "Cn.jpush.android.intent.REGIST ER "/&GT <action android:name= "Cn.jpush.android.intent.REPORT"/> <action android:name= "cn.jpush.android.in Tent. Pushservice "/> <action android:name=" Cn.jpush.android.intent.PUSH_TIME "/> </intent-filter> </service> <!--Required SDK Core features--<receiver Android:name= "Cn.jpush.android.service.PushReceiver" android:enabled= "true" > <intent -filter android:priority= "> <action android:name=" cn.jpush.android.intent.NOTIFICATION_RECEIVED_ PROXY "/> <!--Required Display notification BAR--<category android:name=" Com.example.such "/> </intent-filter> <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= "an Droid.intent.action.PACKAGE_ADDED "/> <action android:name=" Android.intent.action.PACKAGE_REMOVED "/& Gt <data android:scheme= "package"/> </intent-filter> </receiver> <! --Required SDK core functions--<receiver android:name= "Cn.jpush.android.service.AlarmReceiver"/> &L T;/application></manifest>

Sixth step. After writing the code, we push notifications on the portal, assuming that the small partner's Android phone is connected to the computer, then the Jpush Example application can be installed and executed. Before doing the next move. Make sure that the network on the small partners ' phones is available. For example, we want to push content such as the following see:

Seventh step. We take a look at the small series of mobile phones, there will be a miracle, a statement, the following picture of the Yan value is not very high, the small partners will look at Kazakhstan:

Small message: the blog. Small series Basic Simple introduction of the Aurora push the relevant knowledge, and then to participate in the official online demo, small series and once again wrote a. For the big gods of Android. This may not be worth mentioning. But for the small part, happy ing. Or that sentence, for small part, is not only a challenge but also an opportunity, because the knowledge is the same, and secondly. In the program of small programming life. Leave the most precious memories. Although the next small part does not necessarily engage in the industry of Android. In the world of code. Very many things, some sweet, some warm, some tactfully into a song, and some stretches endlessly, in these stories, our only common is that a certain year, a month, some placid days, love you very much before! Love you-this internship in the days, Android brought small series of various surprises, internship life. The story continues ' (*∩_∩*) ...

Aurora Push---Android demo

Related Article

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.