internal static bool sendAndroidNotification(string message, string registrationID) { const String ClientLoginURL = @"https://www.google.com/accounts/ClientLogin"; const String C2DMServerURL = @"http://android.apis.google.com/c2dm/send"; string collapseKey = DateTime.Now.ToShortDateString(); String AuthTokenParams = @"accountType=GOOGLE&Email=" + Properties.Settings.Default.AndroidSenderEmail // your sender email + "&Passwd=" + Properties.Settings.Default.AndroidSenderPassword // your sender password + "&service=ac2dm"; string authToken = getAndroidAuthToken(ClientLoginURL, AuthTokenParams); Dictionary<string, string> data = new Dictionary<string, string>(); data.Add("data.msg", HttpUtility.UrlEncode(message)); // use UrlEncode() so that I can push messages other than English (like Chinese) return sendAndroidPushMessage(C2DMServerURL, registrationID, collapseKey, authToken, data); }
Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts
2012/02/16
[C#] Android C2DM
Subscribe to:
Comments (Atom)