xamarin から使う azure
Post on 22-Jan-2018
2.755 Views
Preview:
TRANSCRIPT
Xamarin から使う Azure
2017/7/25(火)第7回 Tokyo Jazug Night
Japan Xamarin User Group
田淵義人@エクセルソフト
Twitter: @ytabuchi
facebook: ytabuchi.xlsoft
営業(セールスエンジニア) 兼 新規事業開発室 室長Xamarin コミュニティエバンジェリストMicrosoft MVP Visual Studio and Development TechnologiesXamarin MVP
連載・執筆Build Insider Xamarin Tips.NET開発テクノロジ入門2016年版
コミュニティJapan Xamarin User Group 主宰Twitter: @ytabuchifacebook: ytabuchi.xlsoftBlog: Xamarin 日本語情報
2
田淵義人@エクセルソフト
開発者向けソフトウェア販売代理店クラウドサービスもやりたいなぁ
取り扱いのないソフトウェア、サービスもスポットで可能日本円で買いたい海外製品があれば @ytabuchi まで
新規取り扱い製品もどんどん増えてます
3
エクセルソフトの宣伝
注意事項
2017/7/25 時点の情報です。
4
Xamarin とは
C#/.NET/Visual Studio
フル “ネイティブ” アプリ
API 100% 移植
コード共通化
6
Xamarin
C#
7
button.Click += async (sender, e) =>{
var client = new HttpClient();using (var reader = new StreamReader(await client.GetStreamAsync("xxx"))){
var deserializer = new XmlSerializer(typeof(Rss));var latest = deserializer.Deserialize(reader) as Rss;var feed = latest.Channel.Items
.Where(x => x.Link.Contains("xamarin"))
.Select(x => x.Title).ToList();}
};
2つの開発手法
8
Shared C# App Logic
(PCL)
Shared XAML/C# UI Code
(Xamarin.Forms)
iOS
C# UI
Shared C# App Logic
(PCL)
Android
C# UI
Windows
C# UI
Xamarin.FormsXamarin Nativeロジックのみ共通化
UIはネイティブで個別に作りこむ
Xamarin から使う Azure
Xamarin から使う Azure の前に
PCL/Shared Project
Xamarinと、ポータブル・クラス・ライブラリ(PCL) - Build Insider
Xamarin.Forms の PCL ではどの Profile を選択すべきか? -Xamarin 日本語情
NuGet Package Explorer
12
Portable Class Library(PCL)とは
13
.NET Standard
14
15
https://channel9.msdn.com/Events/de-code/2017/TL04
16
https://channel9.msdn.com/Events/de-code/2017/TL04
.NET Standard | Microsoft Docs
主に技術日記: .NET Standard のおさらい
さいきんの.NETのこととかNuGetとかCoreとかよく分からないよねーって話 - Qiita
Xamarin.Forms+.NET Standard 1.6を試す – Takashi Kawasaki – Medium
.NET Standard
Target Frameworks References for NuGet | Microsoft Docs
PackageTargetFallback (new design for Imports) · NuGet/Home Wiki
Oren Novotny » Using Xamarin Forms with .NET Standard – VS 2017 Edition
18
.NET Standard
.NET Standard 対応
19
.NET Standard 1 1.1 1.2 1.3 1.4 1.5 1.6 2
.NET Core 1 1 1 1 1 1 1 2
.NET Framework (*1) 4.5 4.5 4.5.1 4.6 4.6.1 4.6.2 vNext vNext
.NET Framework (*2) 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 4.6.1 4.6.1
Mono 4.6 4.6 4.6 4.6 4.6 4.6 4.6 vNext
Xamarin.iOS 10 10 10 10 10 10 10 vNext
Xamarin.Android 7 7 7 7 7 7 7 vNext
Universal Windows Platform 10 10 10 10 10 vNext vNext vNext
https://docs.microsoft.com/ja-jp/dotnet/standard/library
Microsoft Azure
Mobile Apps
21
Consuming an Azure Mobile App - Xamarin
Azure Mobile Client SDK
22
Mobile Apps
Notification Hubs
23
Sending Push Notifications from Azure Mobile Apps –Xamarin
Add push notifications to your Xamarin.Forms app | Microsoft Docsこれが最新
Push ServicesApple Push Notification Service (APNS)
Firebase Cloud Messaging (FCM)
Windows Notification Service (WNS)
24
Notification Hubs
25
通知の例
Cognitive Services
26
「cognitive」で検索
Cognitive Services のSDK有無@201707 -BEACHSIDE BLOG
27
Azure Portal
28
private async Task<OcrResults> UploadAndRecognizeImage(Stream imageStream, string language){// Create Project Oxford Vision API Service clientVisionServiceClient VisionServiceClient = new VisionServiceClient(Secrets.ComputerVisionApiKey,"https://southeastasia.api.cognitive.microsoft.com/vision/v1.0"
);
// Upload an image and perform OCROcrResults ocrResult = await VisionServiceClient.RecognizeTextAsync(imageStream, language);return ocrResult;
}
SDK
29
public static async Task<string> DoOcrStreamAsync(Stream imageStream, string lang){using (var client = new HttpClient()){// ヘッダーとパラメーターを付与したリクエストを作成client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", Secrets.ComputerVisionApiKey);var sendUri = $"{uriBase}?language={lang}&detectOrientation=true";
// StreamをコンテントとしてPOSTするvar content = new StreamContent(imageStream);content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");var response = await client.PostAsync(sendUri, content);response.EnsureSuccessStatusCode();
// JSONを取得してデシリアライズstring contentString = await response.Content.ReadAsStringAsync();var ocrResultString = JsonConvert.DeserializeObject<OcrResult>(contentString);
}}
REST
分析
テキストの読み取り
手書き文字の読み取り(プレビュー)
著名人およびランドマークの認識
ほぼリアルタイムでビデオを分析
サムネイルの生成
30
Computer Vision API
60 以上の言語のテキスト間での翻訳
自動的に言語を検出
独自翻訳システムを構築
31
Translator API
POSThttps://southeastasia.api.cognitive.microsoft.com/vision/v1.0/ocr
HeaderOcp-Apim-Subscription-Key
Cotent-Type
Cotentapplication/json
multipart/form-data
application/octet-stream
32
REST API
Tokenhttps://api.cognitive.microsoft.com/sts/v1.0/issueToken
Ocp-Apim-Subscription-Key からToken
GETappid
text
from
to
category
33
REST API
Emotional APIEmotion Recognition Using the Emotion API - Xamarin
Cosmos DBConsuming an Azure Cosmos DB Document Database - Xamarin
Azure StorageStoring and Accessing Data in Azure Storage - Xamarin
Azure SearchSearching Data with Azure Search - Xamarin
34
その他の Azure/Xamarin
Azure AD B2CXamarinアプリの認証にAzure AD B2Cを使ってみよう | PaaSがかりの部屋
Bot FrameworkBot FrameworkのDirect Line APIをXamarin.Formsから使う場合のサンプルプログラム - かずきのBlog@hatena
Cognitve Services/Cosmos DBXamarin.Forms と Azure の組み合わせサンプル書いてみたよ - かずきのBlog@hatena
35
おつよい皆様
まとめ
仮想マシンで使うのはもったいない
PaaS!PaaS!PaaS!
Xamarin(モバイル)と絡めると更に面白い!
jazug/JXUG の合同勉強会やハンズオンを(野望)
Azure は面白い
ありがとうございます
田淵義人@エクセルソフト
Twitter: @ytabuchi
facebook: ytabuchi.xlsoft
080-7015-3586
38
top related