Top Banner
Xamarin.Forms でア プリをリリースした 素人の話+α 2015/10/3 JXUGC #6 東京 エクセルソフト株式会社 ソフトウェア事業部 Business Development Manager 田淵 義人
21

Xamarin.Formsでアプリをリリースした素人の話

Apr 16, 2017

Download

Technology

Yoshito Tabuchi
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Xamarin.Formsでアプリをリリースした素人の話

Xamarin.Forms でアプリをリリースした素人の話+α2015/10/3JXUGC #6 東京

エクセルソフト株式会社

ソフトウェア事業部

Business Development Manager

田淵義人

Page 2: Xamarin.Formsでアプリをリリースした素人の話

宣伝 •ユーザーグループに是非ご参加ください• http://jxug.org

• https://www.facebook.com/groups/xm.jxug

• Xamarin 日本語情報• http://ytabuchi.hatenablog.com

•ペゾルドさんの Xamarin.Forms 本 (PDF)

• http://bit.ly/xmfbook

• Xamarin 本• http://www.amazon.co.jp/dp/4822298345 (書籍)

• http://www.amazon.co.jp/gp/product/B00MN5P6PY (Kindle)

Page 3: Xamarin.Formsでアプリをリリースした素人の話

宣伝その2 •今日は登壇いただけませんでしたが、ライフベアさんが Xamarin使いを募集しています。事例を頂けるのを待ってますw

•フェンリルさんも(ry

Page 4: Xamarin.Formsでアプリをリリースした素人の話

少しエモーショナルです

技術ネタは他の方がやってくださったので、主にリリースまでの体験談などを。

Page 5: Xamarin.Formsでアプリをリリースした素人の話

自己紹介 •田淵義人• 目指せ!Xamarinエバンジェリスト

• 目指せ!開発もチョットデキル営業

• 目指せ!Xamarinでググれの自己紹介

• Twitterを Xamarin でエゴサしてる

• Androider, Google 信者

• Twitter: @ytabuchi

• facebook: ytabuchi.xlsoft

• Blog: http://ytabuchi.hatenablog.com/

Page 6: Xamarin.Formsでアプリをリリースした素人の話

自己紹介 •田淵義人• 目指せ!Xamarinエバンジェリスト

• 目指せ!開発もチョットデキル営業

• アプリリリースしました!今日はその話

• 目指せ!Xamarinでググれの自己紹介

• Twitterを Xamarin でエゴサしてる

• Androider, Google 信者 → MS も良いな

• Twitter: @ytabuchi

• facebook: ytabuchi.xlsoft

• Blog: http://ytabuchi.hatenablog.com/

Page 7: Xamarin.Formsでアプリをリリースした素人の話

アプリ開発の経緯

•おでコン (Windows Phoneアプリコンテスト)にアプリを出したい!

Page 8: Xamarin.Formsでアプリをリリースした素人の話

IT勉強会検索 •残念ながら受賞は出来ませんでしたが、とても良い経験になりました

•使ってみて感想頂けると嬉しいです^^

• Windows Phone版• Xamarin.Forms のWindows Phone アプリを

Windows ストアにリリースしてみた

• Android 版• Xamarin.Forms の Android アプリを Google

Play にリリースしてみた

• iOS 版• 個人で Developer Programに加入しました。これから申請。

Page 9: Xamarin.Formsでアプリをリリースした素人の話

開発もチョットデキル営業への道

•大事なもの

•モチベーション

•素人にもやさしく教えてくれる同僚

•営業時間内に営業がコード書いても 20-80の法則で許容してくれる環境

•偉大な先人の方々の情報

•ビルドしてアプリが動いた時の感動

Page 10: Xamarin.Formsでアプリをリリースした素人の話

リリースって大変

•画像ファイル結構沢山用意しないといけない• ベクターで作った方が楽なのでアイコン作成ツールに期待

• Gimpは辛いw

•説明文が 1,000文字とか必要• タイトル、キャッチ、説明文などでかなりダウンロード数とかが変わるらしい

• A/Bテストなど、マーケティングの要素もあって面白い

•ダウンロード数が伸びない問題

Page 11: Xamarin.Formsでアプリをリリースした素人の話

こんなの作りました

Page 12: Xamarin.Formsでアプリをリリースした素人の話

IT勉強会検索 (XF 勉強用アプリ)

Page 13: Xamarin.Formsでアプリをリリースした素人の話

各 OS の Date Picker コントロール

Page 14: Xamarin.Formsでアプリをリリースした素人の話

ざっくり中身説明

Page 15: Xamarin.Formsでアプリをリリースした素人の話

httpclient / Json.NET 楽ちん

try{

using (var client = new HttpClient()){

var response = await client.GetAsync(uri);response.EnsureSuccessStatusCode(); // StatusCode が 200 以外なら Exception

using (var stream = await response.Content.ReadAsStreamAsync()){

using (var streamReader = new StreamReader(stream)){

var json = await streamReader.ReadToEndAsync();var res = JsonConvert.DeserializeObject<ConnpassJson>(json);return res;

}}

}}catch (Exception e) {}

Page 16: Xamarin.Formsでアプリをリリースした素人の話

LINQ 難しい (メソッドで書きたい…)

from evnt in connpassResult.eventsjoin city in cities on SpecifyCity.GetCity(evnt.address) equals citywhere evnt.started_at <= DateTime.Now.AddMonths(5)where evnt.started_at > DateTime.Nowwhere ngWordsList.All(word => !evnt.title.Contains(word))select new AllEventsInfo{

Site = "site_connpass.png",Title = evnt.title,Event_uri = evnt.event_url,Start_at = evnt.started_at,End_at = evnt.ended_at,Description = evnt.description,Overview = HtmlToString.GetString(evnt.description, 50),Address = evnt.address,City = SpecifyCity.GetCity(evnt.address),Accepted = evnt.accepted,Limit = evnt.limit,Organizer = evnt.series == null ? evnt.owner_display_name : evnt.series.title,

};

Page 17: Xamarin.Formsでアプリをリリースした素人の話

XF の DataBinding 楽ちん (XAML)

<TableView Intent="Settings"><TableRoot><TableSection Title="東京・大阪"><SwitchCell Text="東京" On="{Binding TokyoValue, Mode=TwoWay}" /><SwitchCell Text="大阪" On="{Binding OsakaValue, Mode=TwoWay}" />

</TableSection><TableSection Title="北海道地方"><SwitchCell Text="北海道" On="{Binding HokkaidoValue, Mode=TwoWay}" />

</TableSection><TableSection Title="東北地方"><SwitchCell Text="東北地方一括設定" OnChanged="ToggleAreaTohokuValues" /><SwitchCell Text="青森県" On="{Binding AomoriValue, Mode=TwoWay}" /><SwitchCell Text="岩手県" On="{Binding IwateValue, Mode=TwoWay}" /><SwitchCell Text="宮城県" On="{Binding MiyagiValue, Mode=TwoWay}" /><SwitchCell Text="秋田県" On="{Binding AkitaValue, Mode=TwoWay}" /><SwitchCell Text="山形県" On="{Binding YamagataValue, Mode=TwoWay}" /><SwitchCell Text="福島県" On="{Binding FukushimaValue, Mode=TwoWay}" />

</TableSection></TableRoot>

</TableView>

Page 18: Xamarin.Formsでアプリをリリースした素人の話

XF の DataBinding 楽ちん (C#)

// コード側

var dateLabel = new Label

{Style = Application.Current.Resources[“SubColoredLabel”] as Style, // Styles指定

};

dateLabel.SetBinding(Label.TextProperty,new Binding("Start_at", stringFormat: "日時: {0:yyyy/M/d HH:mm} ~")); // stringFormat

var contentLabel = new Label { };

contentLabel.SetBinding(Label.TextProperty,

new Binding("Description", converter: new HtmlToPlainConverter())); // IValueConverter

// IValueConverter 実装

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

{// HtmlAgilityPack を使用してタグ付きの string からタグを除去します。

var hap = new HtmlAgilityPack.HtmlDocument();

hap.LoadHtml(value.ToString());

var doc = hap.DocumentNode.InnerText;

// logic

}

Page 19: Xamarin.Formsでアプリをリリースした素人の話

Dependency Service (頑張りたくないw)

// Interface を PCL に用意

public interface ISaveAndLoad{

void SaveData(string filename, string text);string LoadData(string filename);

}

// Android 実装の例

public void SaveData(string filename, string text){

var documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

var filePath = Path.Combine(documentsPath, filename);// File.WriteAllText ですべて上書きします。AppendAllText だと追加するようです。System.IO.File.WriteAllText(filePath, text);

}

Page 20: Xamarin.Formsでアプリをリリースした素人の話

営業でもXamarin.Formsでアプリが作れるよ!

Page 21: Xamarin.Formsでアプリをリリースした素人の話

ご清聴ありがとうございます