apns 和 asp.net

发布于 2024-11-06 01:35:15 字数 376 浏览 1 评论 0原文

我正在构建使用推送通知的 iPhone 应用程序,一切正常。但现在我将使用 ASP.net 构建服务器端。任何人都可以帮助我...因为我厌倦了使用谷歌找到解决方案,但不幸的是我没有找到任何东西。

....

注意:我尝试了此链接 http://arashnorouzi.wordpress.com/2011/03/31/sending-apple-push-notifications-in-asp-net-part-1/

但帖子尚未完成

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

最美的太阳 2024-11-13 01:35:15

经过几天的工作。我选择与 Urbanairship 合作,它提供了完整的推送服务器:

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()

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()
ヤ经典坏疍 2024-11-13 01:35:15

肯定是完结了。
我用过它,效果很好。

但我不确定它的许可是什么。

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

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

萧瑟寒风 2024-11-13 01:35:15

我使用 Prowl 获取来自 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();
}

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();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文