Currently, Android has not recommended creating notification instances in the following ways:
Notification Notification = new Notification (R.drawable.ic_launcher, "This is ticker text", System.currenttimemillis ()) ;
It is best to use the following methods:
the following link: https://labs.ericsson.com/apis/mobile-java-push /.
3) persistent connection: this solution can solve the performance problem caused by polling, but it will still consume the cell phone's battery. The push service of apple works well because each mobile phone only maintains a connection with the server. In fact, c2dm works like this. However, this solution also has shortcomings, that is,
) {savenotification (ApiKey, username, title, message, URI, id); } }//Whether the user exists or not, the message needs to be stored in the database until the user receives a message to send feedback and then delete Try{User user = Muserservice.getuserbyusername (username);if(NULL! = User Shouldsave) {savenotification (ApiKey, username, title, message, URI, id); } }Catch(Usernotfoundexception e) {//TODO auto-generated catch blockE.printstacktrace (); } }There
the required knowledge points: Notification, ServiceThird party Open source framework: Android-async-http-masterthe source of the push:Android projects, sometimes there is a need: customers every time, just like the server sends a request to get some important, real-time updated messages. such as the version update, whether the request is re-downloaded, etc.The key point is: How do you keep your app's imple
1. Message push mechanismThe server needs to be changed from passive to active, notifying the customer of information that the developer deems important, whether or not the application is running or disabled.
I thought of a sentence: don't call me, I will call you!
Today, a dialog box pops up in the lower right corner of qq: "Obama announces that bin Laden has crashed.
If you are smart, you will be smart. If you like it, you will hate it.
2. Independ
NoticeDirectly on the example, the first simple point, just a hint message, click to call a pageThe second one displays a download prompt with progressExample 1Activity_main.xmlLinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"android:orientation= "Horizontal" > ButtonAndroid:id= "@+id/button1"Android:layout_width
the modified program, such as
Send push notifications through the console
At this point, you can receive push notifications on your phone, which means that the smallest system we have migrated is successful.
For this part of the code, if necessary, please
Click here to download
End
In the example above, I streamlined the official routines in the cod
Recently, due to work relationships, we need to push messages to customers on the Android mobile phone platform. The original push technology on the Android mobile phone platform uses c2dm (cloud to device messaging framework ), however, this year, Google announced its end of support and development and its acceptance
When we are doing Android development, we often encounter the background thread execution, such as downloading files, this time we want to let customers see the background has operations, then we can use the progress bar, so since running in the background, is to try not to occupy the current operating space, The best way for users to do other things is to have a notification message in the
This feature is andorid4.4 support, at least api19 can be used, that is, if the Android machine is less than 4.4, immersion notification bar is ineffective. Here is a brief introduction to the method used.
/**
* Set the notification bar This method is implemented in OnCreate (), if it is added in the parent class's OnCreate (), even if all inherited t
) Unlike in iP In hone, they integrated the hardware system. Therefore, for our developers, if we want to use the C2DM push function in our applications, because different hardware vendor platforms, such as Motorola, Huawei, and ZTE, make a mobile phone, they may remove such services as Google, especially in China, and remove native services such as Google. If you have bought some hosts such as a cottage or Huawei, Google's services may be unavailable
JPush Aurora push quick creation of Android Demo and jpushandroid
Step 1: Create an aurora push developer account
Step 2: Create an application on the Portal
Step 3: download the application Example
Step 4: Import Example (Android
The example in this article describes how the Android program gets the height of the notification bar. Share to everyone for your reference, specific as follows:
This gets the height of the notification bar through the reflection mechanism
The notification bar height is wr
1, the background running a service interval 5s from the server to get data once, according to business needs, when the need to remind users, from the right to automatically underlineA similar effect is as follows: Notification pop-up on any interface2. Realization ProcessThe root layout of the ①android is called Dector (obtained by: Window.getdecotrview ()),② in activity Setcontview set the activity layout
> Most of the currently widely used server push technologies are encapsulated in XMPP protocol.
> Have you ever touched XMPP? In Linux, some IM clients will allow you to add accounts that support the XMPP protocol, such as ICQ and MSN by default. In addition, QQ is also based on XMPP, gmail and Gtalk in Android are also based on XMPP protocol.
> The following is a simple analysis of androidpn encapsulation
;
Developmentloglevel = 3
productionloglevel = 6Note Replace the Developmentappkey and Developmentappsecret values (which can be obtained from the application created in the urban airship)
5. Modify the Res/values/strings.xml file, add a few values first, then use the following
6. Modify the layout file, the project defaults to create a activity_main.xml, here also need to add a layout to display notification. Activity_main.xml (there may be an erro
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 fi
First step: Create Aurora push Developer account
Step Two: Portal Create an app on
Step three: Download the app example
Fourth Step: put example (Android project) into Eclipse in
Fifth step: Run Example this application
Sixth step:
The following example assumes that Google's GCM has been configured.
1. First add the gcm. jar package to the libs directory and add it to the classpath.
2. First modify the AndroidManifest. xml file to add support for GCM.
[Html]Package = "urbanairship. client"Android: versionCode = "1"Android: versionName = "1.0" type = "codeph" text = "/codeph">...
Transferred from: http://m.oschina.net/blog/82059The main purpose of this article is to analyze and contrast the most mainstream message push schemes on the Android platform, objectively reflect the advantages and disadvantages of these push schemes, and help us choose the most suitable implementation plan.Scenario 1,Using GCM Services (Google Cloud Messaging)Int
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.