Mouhamad Lamaa
Mouhamad Lamaa

Reputation: 884

apns and asp.net

I'm building and iPhone application the use push notification, all is ok. but now i'm going to build the server side with ASP.net. can any one help mee... coz i tired to get a solution using Google but unfortunately i didn't find any thing.

....

note: i tried this link http://arashnorouzi.wordpress.com/2011/03/31/sending-apple-push-notifications-in-asp-net-part-1/

but the post not completed yet

Upvotes: 1

Views: 4253

Answers (4)

Mouhamad Lamaa
Mouhamad Lamaa

Reputation: 884

After days of work. I chose to work with Urbanairship which provides a full push server:

Dim request As WebRequest = WebRequest.Create("https://go.urbanairship.com/api/push/broadcast/")
Dim postData As String = "{""aps"": {""badge"": ""+1"", ""alert"": ""Estez Mohamad lamaa!"",""sound"": ""default""}}"
request.Credentials = New NetworkCredential("uorecode", "uorkey")
request.Method = "POST"
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
request.ContentType = "application/json"
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim response As WebResponse = request.GetResponse()
dataStream = response.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Console.WriteLine(responseFromServer)
reader.Close()
dataStream.Close()
response.Close()

Upvotes: 1

mrwoodo
mrwoodo

Reputation: 1

I use Prowl for notifications from ASP.NET:

public static void PushNotification(string header, string message)
{
    new Thread(() =>
        {
            var prowlURL = string.Format("https://api.prowlapp.com/publicapi/add?apikey={YOURKEY}&application={0}&description={1}", header, message);

            WebClient wc = null;
            try
            {
                wc = new WebClient();
                wc.UploadString(new Uri(prowlURL), "");
            }
            catch
            {
            }
            finally
            {
                if (wc != null)
                {
                    wc.Dispose();
                    wc = null;
                }
            }
        }) { Name = "PushNotification", IsBackground = true }.Start();
}

Upvotes: 0

Guy
Guy

Reputation: 5528

It is definitely finished. I used it, and it works great.

However i'm not sure what's its licensing.

Upvotes: 0

Related Questions