. Net platform pushes Android messages (Aurora push) with third-party push services)

Source: Internet
Author: User

Recently done. net project (Windows Service) needs to send push messages to the Android mobile phone, it is a bit difficult, without having to do so, it will not stop searching documents, finally saw an open-source project PushSharp, can be in. net platform pushes messages to devices such as IOS, Android, and Windows Phone, and then performs IOS first. This is a success. However, when you do Android, the push fails, the program was executed, but the push was always available. Later, I searched online and did not find it. Finally, I gave up using this push Android and found another way. Then I found a C2DM cloud push function, however, the problem arises again. (1) C2DM is built into the Android 2.2 System and cannot be compatible with the old 1.6 to 2.1 systems; (2) c2DM depends on the C2DM Server officially provided by Google. Due to the domestic network environment, this service is often unavailable. If you want to use it well, our App Server must also be abroad, this may not be implemented by every developer; (3) 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. For example, those who go abroad may be built in. No way, finally go to the third-party PUSH Service Platform, Aurora push. The following describes how to use Aurora push.

1. First, register your app on the Aurora official website and obtain an ApiKey and an APIMasterSecret (password). Save these two values in the configuration file (app/web. config. net platform

<appSettings>    <add key= value=/>    <add key= value=/> </appSettings>

2. Read the value in the configuration.

   ApiKey =    APIMasterSecret = = ConfigurationManager.AppSettings[].ToString();APIMasterSecret = ConfigurationManager.AppSettings[].ToString();

3. Start the push method.

                             PushAndroid(=  sendno = ran.Next(, );                 app_key = masterSecret = receiver_type = ;                 receiver_value = msg_type = ;                 msg_content =  + Title +  + Content + ;                 platform = ;                 verification_code = GetMD5Str(sendno.ToString(), receiver_type.ToString(), receiver_value,masterSecret);                 postData =  ++= ( ++= ( ++= ( ++= ( ++= ( ++= ( ++= ( ++= ( +                [] data = resCode = GetPostRequest(data);            }            

4. MD5 encrypted verification string. Aurora performs verification when calling an interface.

                                      GetMD5Str(  str = ( i=;i<paras.Length;i+++=[] buffer = md5Str =  ( i = ; i < buffer.Length; i++= md5Str + buffer[i].ToString(

5. call Aurora PUSH Service in http Post Mode

                                       GetPostRequest(= (HttpWebRequest)WebRequest.Create(= = ==            newStream.Write(data,              response = ( reader =  StreamReader(response.GetResponseStream(), Encoding.GetEncoding( result =

6. Define a class and receive the returned value

   sendno;          {  { sendno =  msg_id;          {  { msg_id =  errcode;          {  { errcode =  errmsg;          {  { errmsg =

Okay, okay. What's wrong? I hope you can point it out. Thank you!

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.