Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ASP.NET MVC4 Web APIをバックエンドにして作るストアとWindows Pho...
Search
tanaka_733
July 06, 2013
Technology
1.9k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ASP.NET MVC4 Web APIをバックエンドにして作るストアとWindows Phoneプッシュ通知アプリ
2013年7月6日 めとべや東京の発表資料
tanaka_733
July 06, 2013
More Decks by tanaka_733
See All by tanaka_733
SRENEXT 2020 [B5] New RelicのSREに学ぶSREのためのNew Relic活用法
tanaka733
2
11k
Calling PowerShell from CSharp
tanaka733
0
2k
Garbage Collection in .NET Framework
tanaka733
4
3k
New Features in Visual Studio 2013
tanaka733
0
1.1k
Starting Unity for Windows Store App
tanaka733
0
880
とあるインフラエンジニアのAzure活用
tanaka733
2
620
ぼくの考えた割と普通(c)なデプロイ戦略
tanaka733
1
11k
Yurufuwa_CSharp.pdf
tanaka733
0
5.1k
Windows ストアアプリで Push通知を使いこなそう
tanaka733
0
2.1k
Other Decks in Technology
See All in Technology
サーバーレスをどこまで使う? WebRTC対戦ゲームで選んだVPSとの共存設計
kaidouji85
0
180
CLIライブラリ開発を支える技術
htnabe
0
140
C#コードの結合を可視化する Roslyn解析による設計改善と リファクタリング判断
dora56
0
210
Azure Serverless 2026:Production-ready な AI エージェント基盤 / Azure Serverless 2026: Production-Ready AI Agent Platform
miyake
2
350
AIによるクリエイティブ生成を行う上での試行錯誤
plaidtech
PRO
0
160
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
490
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
490
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
0
200
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
160
JSONataとAWS Step Functionsで目指すRuntimelessな世界
mu7889yoon
0
280
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
110
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
3.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
360
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
610
Skip the Path - Find Your Career Trail
mkilby
1
230
Designing Powerful Visuals for Engaging Learning
tmiket
1
570
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
910
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
How to Ace a Technical Interview
jacobian
281
24k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
530
Transcript
ASP.NET MVC 4 Web API を バックエンドにして作る ストアとWindows Phone プッシュ通知アプリ
めとべや東京 #1 2013/07/06 @tanaka_733
今日のセッションで触れるトピック 今まで何度かとりあげたプッシュ通知で 実際のアプリを作ったらどうなるか Azure Web Sites とAzure Mobile Services の違い
プッシュ通知とバックグランドタスク
自己紹介(@tanaka_733) お仕事 謎社エンジニア (インフラ) 最近は Win Server 2012 / IIS8
/ ARRv3 あたりをさわりつつ WPFとかASP.NET MVC Web API とかで管理ツールを 作ったりしてます 個人活動 めとべや東京 http://metrostyledev.net/ ブログ 銀の光と碧い空 http://techblog.hilife-jp.info/ Microsoft MVP for Visual C# 受賞しました
セッションのきっかけ 某弊社では、NewRelicというサービスを使っております .NET Framework に対応したパフォーマンス監視サービス Azureにも対応 .NET最先端技術によるハイパフォーマンスウェブアプリケーション
障害時のプッシュ通知ができます
た だ し
iPhone に限る!
Windows Phone でも 受信したい! © 2012 Microsoft Corporation. All rights
reserved.
Windows 8 でも 受信したい!!! © 2012 Microsoft Corporation. All rights
reserved.
そうだプッシュ通知を使おう
システム概要 Web Site WNS Store Client Phone Client Background Tasks
Background Tasks Web Hook Push通知 Push通知 Uri登録
ポイント サーバーサイド Azure Mobile Services を使うか、Web Sitesを使うか、 その他か Windows Store
App オフライン受信時に対応するバックグランドサービス Channel URIを更新するバックグランドサービス Windows Phone App プッシュ通知 実際に手を動かしてはまったことを中心にお話しします
あらかじめ・・・ 今回はプッシュ通知の基本的な実装の説明は省略します 以前のセッションを参考にしてください Windowsストアアプリで Push通知を使ってみよう https://speakerdeck.com/tanaka733/windowssutoaapuride- pushtong-zhi-woshi-tutemiyou Windows ストアアプリで Push通知を使いこなそう
https://speakerdeck.com/tanaka733/windows-sutoaapuride- pushtong-zhi-woshi-ikonasou
Web Sites を選んだ理由 HTTPS (SSL)で受ける必要がある(特にストアアプリ) 自前サーバーや AWS Elastic BeanStalkは SSL証明書を自前で手配する必要あり
Azure Mobile ServiceやWeb Siteは必要なし Web Hookを受ける必要あり NewRelicが障害時にWebHookに通知するため、 APIの受け口が必要 Mobile Servicesではできなかった (6月のアップデートで可能に) C# (ASP.NET MVC)でコーディングしたい 自分の好み Mobile ServicesではJavaScript (Node.js)
サーバーサイドの実装 クライアントからのChannel URIの登録を受け付けるAPI テーブルに格納する 1端末につき1つだが、 更新することがあるので、端末IDが必要 取得の仕方は各クライアントの説明で アプリとして運用を考えるなら認証を入れた方がよい WebHookのURIを受けるAPI 各サービス(今回はNewRelic)の仕様に従う
最近のトレンドはJSONでPOST 受けたあと、Channel URIの一覧を取得してWNSに配信
Azure Web Siteのデバッガビリ ティ Windows Azure SDK 2.0 で大幅強化 Visual
Studio からWeb Siteの設定が可能に ログのストリーミングが可能に 使い方 Sytem.Diagnostic.Trace を使って出力するのみ これでリモートデバッグが可能になれば無敵なのだが…
Windows Store App アプリ起動時にChannelURIの取得 前回サーバーに登録したChannel URIと比べて違えば更新 する 前回の値はSQLiteに保存 設定ファイルだと、バックグラウンドタスクとの同時編集による競合が ありうる
(頻度は少ないけど) プッシュ通知受信後の処理 外部URIをチェックしてブラウザを起動するようにする 2つのバックグランドタスクの実装 実装時に気を付けないとはまりどころ多し
バックグランドタスクの実装 バックグラウンドタスクは別プロジェクトとして実装 共通処理はクラスライブラリ化するのがおすすめ メインのプロジェクトが参照するようにする マニフェストファイルを編集して許可する アプリ実行時に登録する
ChannelURIを更新する バックグラウンドタスク ChannelURIの有効期間は1か月 1か月経つとURIは変更される可能性がある アプリの性質上1か月以上起動されない可能性がある アプリが起動されないとChannelURIの登録ができない
Windows Phone Appの実装 基本はストアアプリと同様 オフライン受信は今回対応せず プッシュ通知の配信先やフォーマットが多少異なる トースト通知として実装
まとめ C# を使って、プッシュ通知の端末側とサーバー側の両方を開 発できます Azure Web Sitesはデバッガビリティも上がって来ていて、 使いやすくなっています ストアアプリのバックグラウンドタスクを使って Channel
URIの更新を行いました 今回のアプリのソースコードはこちら(のちほど、かなり未整 理) https://github.com/tanaka-takayoshi/PushNotificationServcies