Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
ResearchonXamarinByRongZhuangAugust19,2015
1. Introduction1.1 MainFeatures
• Cross-Platform(C#)Ø iOS(Xamarin.iOS)Ø Android(Xamarin.Android)Ø Mac(Xamarin.Mac)
• XamarinInsights• XamarinTestCloud(Xamarin.UITest)
1.2 IDE• Mac:XamarinStudio,Xcode• Windows:XamarinStudioorVisualStudio+Xamarin’splug-inforVisualStudio,Mac,
Xcode,Xamarin.iOSBuildHost1.3 XamarinAccount(perdeveloper,perdeviceplatform)
• Trail(30days)-free• Indie-$25/Month($300/Year)• Business-$83/Month($999/Year)• Enterprise-$158/Month($1899/Year)• ForStudent-Free(Needtoapply)
2. iOSDevelopment
TherearetwooptionstosetupthedevelopmentenvironmentforiOS:• XamarinStudioonMac• VisualStudioonPC(withanothermacconnectedtothesamenetworkofPC),seebelow.
Note:XamarinStudioonPCcannotbeusedforiOSdevelopment.
2.1 Installation(Windows)• XamarinPlatformforWindows• Xamarin.iOSBuildHostonMac
2.2 DevelopinginVisualStudio2013
Note:MustbeconnectingtoBuildHostofMacwheneditingthelayout.
2.3 TestinsimulatoronMac.
2.4 Testonrealdevice.
Note:PluginyouriphoneoripadtoMACbeforerunningthetest.
2.5 DevelopinginXamarinStudio(Mac)
2.6 Deployment
PublishingtotheAppStorehttp://developer.xamarin.com/guides/ios/deployment,_testing,_and_metrics/app_distribution_overview/publishing_to_the_app_store/
3. AndroidDevelopmentTherearethreeoptionstosetupthedevelopmentenvironmentforAndroid:• XamarinStudioonMac• XamarinStudioonPC• VisualStudioonPC
3.1 Installation(Windows)• XamarinPlatformforWindows• AndroidSDKandEmulator
3.2 DevelopinginVisualStudio2013.
3.3 Testinemulator,AVD(AndroidVirtualDevice).
3.4 DevelopinginXamarinStudio(Mac)
3.5 PublishandDeploymentinVisualStudio.
4. XamarinInsights
5. XamarinTestCloud• Xamarin.UITest(C#)• Calabash(Ruby)
Costs:
6. Cross-Platform6.1 Separatedcomponents
• Xamarin.Android• Xamarin.iOS• Xamarin.WP8
6.2 Xamarin.Form(UnifiedUIdevelopmentprocess)Xamarin.FormsintegrateswithXamarin.iOSandXamarin.Android.
6.3 SharingCodes
• PortableClassLibrary(PCL):dlls• SharedAssetProject(SAP):codeandassetsfiles
TheiOSandAndroidprojectshaveaccesstoprettymuchthesameversionof.NET,butitisnotthesameversionof.NETthataWindowsPhoneprojectuses.Thismeansthatany.NETclassesaccessedbythesharedcodemightbesomewhatdifferentdependingontheplatform.Asyou’lldiscoverlaterinthisbook,thisisthecaseforsomefileI/OclassesintheSystem.IOnamespace.
7. StoreData7.1 TransientData
• Application.Properties(stringkey,objectitem)• ApplicationEvents(OnStart,OnSleep,OnResume)
Note:IfeachitemofthisdataisanentryinthePropertiesdictionary,eachitemneedsadictionarykey.However,ifaprogramneedstosavealargefilesuchasaword-processingdocument,itshouldn’tusethePropertiesdictionary,butin-steadshouldaccesstheplatform’sfilesystemdirectly.
7.2 LargeFilePlatform’sfilesystem:Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); Xamarin.Forms.DependencyService
8. PrototypeofCoursePlayer8.1 Layout
Useaslider,labelandbuttontosimulatevideoplaying.
8.2 Components• COL.Corecontainsthecorefunctiontogetandconvertdata.• CoursePlayeriPhonecontainsthecourserelatedfilesandrendertheUI.
8.3 UMLclassdiagram
9. ImportantConcerns9.1 DoesXamarinprovidethesupportofthethird-partylibraries?How?
Yes,Xamrainsupportsnotonly.NETbasedclasslibraries,butalsoObjective-C,Java,HTMLorJavascripttoreuseinXamarin.Walkthrough:BindinganObjective-CLibraryhttp://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/Walkthrough_Binding_objective-c_library/1) First,we'llcreateanObjective-CstaticlibraryusingXcode.2) Thenwe'llbindingthisstaticlibrarywithXamarin.iOS.3) Next,showhowObjectiveSharpiecanreducetheworkloadbyautomaticallygenerating
some(butnotall)ofthenecessaryAPIdefinitionsrequiredbytheXamarin.iOSbinding.4) Finally,we'llcreateaXamarin.iOSapplicationthatusesthebinding.
9.2 IOinterfaces,eg.fileread/write
9.3 Whatfeatures,especiallythesystemrelevantfunctionalities,doesXamarinprovide?
Briefly,Xamarinsupportsunifiedcross-platformfeatures.Separately,itsupportsplatformaimedfeatures.http://developer.xamarin.com/recipes/
9.4 HowdoesXamarinfollowthenewreleasesofnativeplatforms,iOSandAndroid?
10. OverviewConclusion
1) Xamarinhasgreatsupportforcross-platformmobiledevelopment.2) ThedevelopmentcostishighbyusingXamarin.3) DevelopersarerequiredtohavetheknowledgeofC#(.Net),Xamarin(Mono),iOS
developmentandAndroidDevelopment.4) ForiOS,thelayoutdesignisnotsupportedenough(eg.autolayout),maybeneedto
createseparateprojectsforiPhoneandiPad.
11. FeatureComparisonfromPortfolioPerspective Native XamarinDevelopmentCommunity
Maturedmobileplatformwithplentyofmaterials/documents.
Lackofresources,like,books,third-partylibraries,etc.
Features/Functionalities
Cangettheentirefeatures/functionalitiesprovidedbytheSDK.
Someofthenativefeaturesarenotsupportedverywell(eg.Autolayout).
Third-PartyLibrary Fullysupported Needssomeextraefforttoachievethesamepurpose.
Coding Purenativecodes HybridofMono,iOSandAndroid
Debugging ComfortablewithXcode,AndroidStudio
ComfortablewithVisualStudio
Deployment Standardprocedure Alittlemoreextraworkrequired.
Extendibility Easytoaddnewfeatures Inmostcases,itispossibletoaddnewfeature,butneeddosomeresearchingworkfirst.
Reusable Low High,ifmoreplatformsarerequired.Besides,thesharedlibrarycanbeenhancedtosupportwebapplication.
EffortinDevelopmentphase
High Low,ifmoreplatformsarerequired
Effortinmaintenancephase
High Low,especiallywhenthebugisnotrelevantwithUI.
RequiredDevelopers 2(1foriOS,1forAndroid) 3(1forXamarinsharedlibrary,1foriOSUI,1forAndroidUI)
Developer’sQualification
Platformspecifiedknowledge Cross-platformknowledge,Xamarinplatform,plusC#,Mono
LicenseFee(PerYear) iOS$99;Androidfree iOSdeveloperaccount$99XamariniOS:$999XamarinAndroid:$999
PotentialRisk None UncertaintyofXamarin’sfuture.ThecomparisonisbasedontheassumptionthatourAPPonlysupportsiOSandAndroid.
12. Reference• http://xamarin.com/faq• https://components.xamarin.com/• http://developer.xamarin.com/recipes/ios/general/file_system/load_a_file/• http://developer.xamarin.com/recipes/android/data/files/• http://developer.xamarin.com/recipes/• http://developer.xamarin.com/guides/cross-platform/insights/