• 2017. 03. 23.
  • 읽는 데 6분
     
    •  

Handling Platform Divergence & Features

Divergence isn’t just a ‘cross-platform’ problem; devices on the ‘same’ platform have different capabilities (especially the wide variety of Android devices that are available). The most obvious and basic is screen size, but other device attributes can vary and require an application to check for certain capabilities and behave differently based on their presence (or absence).

This means all applications need to deal with graceful degradation of functionality, or else present an unattractive, lowest-common-denominator feature set. Xamarin’s deep integration with the native SDKs of each platform allow applications to take advantage of platform-specific functionality, so it makes sense to design apps to use those features.

See the Platform Capabilities documentation for an overview of how the platforms differ in functionality.

Examples of Platform Divergence

Fundamental elements that exist across platforms

There are some characteristics of mobile applications that are universal. These are higher-level concepts that are generally true of all devices and can therefore form the basis of your application’s design:

  • Feature selection via tabs or menus
  • Lists of data and scrolling
  • Single views of data
  • Editing single views of data
  • Navigating back

When designing your high-level screen flow you can base a common user experience on these concepts.

Platform-specific attributes

In addition to the basic elements that exist on all platforms, you will need to address key platform differences in your design. You may need to consider (and write code specifically to handle) these differences:

  • Screen sizes – Some platforms (like iOS and earlier Windows Phone versions) have standardized screen sizes that are relatively simple to target. Android devices have a large variety of screen dimensions, which require more effort to support in your application.
  • Navigation metaphors – Differ across platforms (eg. hardware ‘back’ button, Panorama UI control) and within platforms (Android 2 and 4, iPhone vs iPad).
  • Keyboards – Some Android devices have physical keyboards while others only have a software keyboard. Code that detects when a soft-keyboard is obscuring part of the screen needs to be sensitive to these differences.
  • Touch and gestures – Operating system support for gesture recognition varies, especially in older versions of each operating system. Earlier versions of Android have very limited support for touch operations, meaning that supporting older devices may require separate code
  • Push notifications – There are different capabilities/implementations on each platform (eg. Live Tiles on Windows).

Device-specific features

Determine what the minimum features required for the application must be; or when decide what additional features to take advantage of on each platform. Code will be required to detect features and disable functionality or offer alternatives (eg. an alternative to geo-location could be to let the user type a location or choose from a map):

  • Camera – Functionality differs across devices: some devices don’t have a camera, others have both front- and rear-facing cameras. Some cameras are capable of video recording.
  • Geo-location & maps – Support for GPS or Wi-Fi location is not present on all devices. Apps also need to cater for the varying levels of accuracy that’s supported by each method.
  • Accelerometer, gyroscope and compass – These features are often found in only a selection of devices on each platform, so apps almost always need to provide a fallback when the hardware isn’t supported.
  • Twitter and Facebook – only ‘built-in’ on iOS5 and iOS6 respectively. On earlier versions and other platforms you will need to provide your own authentication functions and interface directly with each services’ API.
  • Near Field Communications (NFC) – Only on (some) Android phones (at time of writing).

Dealing with Platform Divergence

There are two different approaches to supporting multiple platforms from the same code-base, each with its own set of benefits and disadvantages.

  • Platform Abstraction – Business Façade pattern, provides a unified access across platforms and abstracts the particular platform implementations into a single, unified API.
  • Divergent Implementation – Invocation of specific platform features via divergent implementations via architectural tools such as interfaces and inheritance or conditional compilation.

Platform Abstraction

Class Abstraction

Using either interfaces or base classes defined in the shared code and implemented or extended in platform-specific projects. Writing and extending shared code with class abstractions is particularly suited to Portable Class Libraries because they have a limited subset of the framework available to them and cannot contain compiler directives to support platform-specific code branches.

Interfaces

Using interfaces allows you to implement platform-specific classes that can still be passed into your shared libraries to take advantage of common code.

The interface is defined in the shared code, and passed into the shared library as a parameter or property.

The platform-specific applications can then implement the interface and still take advantage of shared code to ‘process’ it.

Advantages

The implementation can contain platform-specific code and even reference platform-specific external libraries.

Disadvantages

Having to create and pass implementations into the shared code. If the interface is used deep within the shared code then it ends up being passed through multiple method parameters or otherwise pushed down through the call chain. If the shared code uses lots of different interfaces then they must all be created and set in the shared code somewhere.

Inheritance

The shared code could implement abstract or virtual classes that could be extended in one or more platform-specific projects. This is similar to using interfaces but with some behavior already implemented. There are different viewpoints on whether interfaces or inheritance are a better design choice: in particular because C# only allows single inheritance it can dictate the way your APIs can be designed going forward. Use inheritance with caution.

The advantages and disadvantages of interfaces apply equally to inheritance, with the additional advantage that the base class can contain some implementation code (perhaps an entire platform agnostic implementation that can be optionally extended).

Xamarin.Forms

See the Xamarin.Forms documentation.

Other Cross-Platform Libraries

These libraries also offer cross-platform functionality for C# developers:

Conditional Compilation

There are some situations where your shared code will still need to work differently on each platform, possibly accessing classes or features that behave differently. Conditional compilation works best with Shared Asset Projects, where the same source file is being referenced in multiple projects that have different symbols defined.

Xamarin projects always define __MOBILE__ which is true for both iOS and Android application projects (note the double-underscore pre- and post-fix on these symbols).

C#복사

#if __MOBILE__ // Xamarin iOS or Android-specific code #endif iOS

Xamarin.iOS defines __IOS__ which you can use to detect iOS devices.

C#복사

#if __IOS__ // iOS-specific code #endif

There are also Watch- and TV-specific symbols:

C#복사

#if __TVOS__ // tv-specific stuff #endif #if __WATCHOS__ // watch-specific stuff #endif Android

Code that should only be compiled into Xamarin.Android applications can use the following

C#복사

#if __ANDROID__ // Android-specific code #endif

Each API version also defines a new compiler directive, so code like this will let you add features if newer APIs are targeted. Each API level includes all the ‘lower’ level symbols. This feature is not really useful for supporting multiple platforms; typically the __ANDROID__ symbol will be sufficient.

C#복사

#if __ANDROID_11__ // code that should only run on Android 3.0 Honeycomb or newer #endif Mac

There is not currently a built-in symbol for Xamarin.Mac, but you can add your own in the Mac app project Options > Build > Compiler in the Define symbols box, or edit the .csproj file and add there (for example __MAC__)

XML복사

<PropertyGroup><DefineConstants>__MAC__;$(DefineConstants)</DefineConstants></PropertyGroup> Universal Windows Platform (UWP)

Use WINDOWS_UWP. There are no underscores surrounding the string like the Xamarin platform symbols.

C#복사

#if WINDOWS_UWP // UWP-specific code #endif Using Conditional Compilation

A simple case-study example of conditional compilation is setting the file location for the SQLite database file. The three platforms have slightly different requirements for specifying the file location:

  • iOS – Apple prefers non-user data to be placed in a specific location (the Library directory), but there is no system constant for this directory. Platform-specific code is required to build the correct path.
  • Android – The system path returned by Environment.SpecialFolder.Personal is an acceptable location to store the database file.
  • Windows Phone – The isolated storage mechanism does not allow a full path to be specified, just a relative path and filename.
  • Universal Windows Platform – Uses Windows.Storage APIs.

The following code uses conditional compilation to ensure the DatabaseFilePath is correct for each platform:

C#복사

public static string DatabaseFilePath { get { var filename = "TodoDatabase.db3"; #if SILVERLIGHT // Windows Phone 8 var path = filename; #else #if __ANDROID__ string libraryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); ; #else #if __IOS__ // we need to put in /Library/ on iOS5.1 to meet Apple's iCloud terms // (they don't want non-user-generated data in Documents) string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine (documentsPath, "..", "Library"); #else // UWP string libraryPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path; #endif #endif var path = Path.Combine (libraryPath, filename); #endif return path; }

The result is a class that can be built and used on all platforms, placing the SQLite database file in a different location on each platform.

안녕하세요. 어이없이 회사에 출근해서 바이러스 박멸중이에요. 어제 피씨가 안된다는 연락을 받고 확인해보니 해당 부서의 피씨만 안되고 있더라구요.

일부피씨회수해서 확인해보니 야사,야동이 꽤 많이 발견되었네요. 그런거 보고 싶으면 집에가서보던가..나이 먹고 할짓 없어서 회사 피씨에다 그런 몹쓸짓을....
음란사이트 차단해놔도 새로운 사이트가 생겨놔서 사전에 막아놓는 것도 힘들더라구요..

그런건 어떻게들알고 귀신같이 찾아서 들어가는지..대단한것 같아요. 그런 열정으로 일을 더하지.. 쓰다보니 푸념이되었네요.

다행히 MZK라는 백신이 잘 잡아줘서 돌리고 있는데 시간이 너무 걸리네요.

역쉬 mzk!!이거 아니었으면 집에 못갈뻔했어요.
물론 저만 출근했고 사고친부서는 집에서 쉬고 있어요.
이상하게 딴짓하다 피씨문제생기면 전산담당 잘 못으로 몰아가니 그런 분위기가 더 힘들게 만들어요.
관리하랴 개발하랴 고쳐주랴...등등 관리와 개발은 인정하겠는데 딴짓 하다 고장낸 피씨까지 봐주기는..아오~열받아..

이상으로 백신 돌리면서 작성한 푸념포스팅을 마칠게요.

안녕하세요. 3D프린터를 조립하고 출력하는데 실패한 글을 쓴적이 있어요.

https://hicomputing.tistory.com/301?category=740867

 

3d프린터 anet a8 도전기- 실패

안녕하세요. 3D프린터기를 구매해서 방치해두다가 겨우 겨우 조립까지 했어요. 하지만 완성되고 보니 조립을 실수한 부분도 있고 마스킹테이프를 제거해서 출력물이 고정이 안되는 문제가 있더라구요. 그래서 이..

hicomputing.tistory.com

실패 원인을 생각해보니 레벨링(수평작업)을 잘 못 한 것 같아서, 하는 수없이 오토레벨링부품을 사서 축로 장착해보기로 했어요.

물론 구매 할때 부족한 부품도 같이 구매했어요.

구매한 부품은

1. 타이밍 벨트 클램프

2.노즐클리너 청소용바늘

3. 미니수평기

4. 오토레벨링센서

5.마스킹테이프

6. 필라멘트 화이트

마스킹테이프는 출력물이 움직이지 않게 고정해주는 역활을 하더라구요. 전 그것도 모르고 처음에 살때 부탁되어 있던 마스킹테이프가 기스방지용으로 붙어있는 것인줄 알고 제거 했더니 출력물이 이리저리 움직여서 애먹었어요.

012

구매한 부품들의 사진이에요. 첫번째 사진에서 위에 검은색 케이블과 같이 있는 것이 오토레벨링 센서에요.

오토레벨링 센서를 장착하는 방법은 Z축을 케이블까지 제거하고 설치하면 되는데 유투브에 ANET A8 오토레벨링으로 검색하면 관련 영상이 나와서 그것을 보고 따라 했어요.

마스킹테이프를 붙이고 필라멘트를 설치한 모습인데, 마스킹테이프는 테스트 출력후 출력물 제거하다가 찢어졌어요.

출력하고 바로 제거하면 안되고 충분히 식으면 제거해야 하더라구요.

사진에 보이는 하늘색 부품이 오토레벨링 센서에요. 인터넷에서 검색해보면 호불호가 갈리지만 전 충분히 만족하면서 사용했어요. 첨에 설치할때 헷갈리기는 하지만 설치후에 잘 작동해요.

간단한 미니박스를 테스트로 출력해봤어요.

https://www.youtube.com/watch?v=n-2gwFp2VP0

동영상길이가 기니까 넘기면서 보시는게 좋을 것 같아요. 그냥 이런느낌으로 출력하는 구나 정도에요.

 

출력물이에요.층이 보이기는 하지만 워낙저가의 3D프린터다보니 전 결과에 만족하고 있어요.

두번째 출력물을 테스트 할때는 히팅 에러가 발생해서 원인을 찾고 있어요.

큰문제가 아니길 바라면서 이번 포스팅을 마칠게요.

별이되어라! 시즌7 두번째 이야기 "격변의 바람" 업데이트!

https://appfing.com/1822536

 

별이되어라! 시즌7 두번째 이야기

 

appfing.com

감동적인 시나리오 & 유니크한 그래픽

글로벌 1,200만명이 선택한 RPG! 별이되어라!

 

EVERYDAY 즐기는 컨텐츠!

☞매일 바뀌는 월드보스와 10vs10 대규모 아레나

 

EVERYWEEK 꿀혜자 이벤트!

☞ 매주 진행되는 다양한 이벤트!

 

EVERYMONTH 새로운 업데이트!

☞ 매월 업데이트 되는 다양한 캐릭터!

 

★ ★ ★ ★ ★ 게임 특징 ★ ★ ★ ★ ★

1. 2D로 만들어진 개성넘치는 수 백 명의 최상위 퀄리티의 캐릭터

2. 화려하고 타격감 넘치는 전투

3. 매일 매주 매월 바뀌는 다양한 컨텐츠와 신선한 이벤트

4. 핸즈 오프 모드를 사용하면 게임을 꺼도 끝없는 성장 가능

 

별이되어라! 공식 카페

http://cafe.naver.com/dragonblaze

  

* 업데이트 내용 참고

 - https://cafe.naver.com/dragonblaze/3249108

 - https://cafe.naver.com/dragonblaze/3249401

   

닥터크롬벨의 부활! 라이제르 기사단 [긴/급/모/집]

https://appfing.com/5147209

 

같지만 또 다른 이야기

닥터크롬벨의 부활! 라이제르 기사단 [긴/급/모/집]

appfing.com

STORY 세계관

닥터크롬벨의 거대한 야욕을 물리치고 라이제르는 다시 긴 수면기를 맞이했다.

무엇을 예감한 것인지 수면기에 들기전 라이제르의 얼굴은 너무나 슬퍼보였다.

그리고 자신에게 특별한 삶을 살게 해준 한신우를 마지막까지 쳐다보며 잠이 들었다.

 

그렇게 한신우는 KSA의 요원이 되었고...세상은 평화로워지는 것 같았다.

그러나 라이제르의 염려는 곧 현실이 되었다.

 

10년 후 어느 날 다크 스피어를 지배하게 된 닥터크롬벨이 봉인을 풀고 다크 크롬벨로 헌신한 것이다.

유니온 잔당들을 통합하여 전 세계를 상대로 전쟁을 일으켰고, 그가 지배하는 다크스피어는 지옥이었다.

 

그가 일으킨 전쟁에서 사망한 인류는 모두 다크스피어의 먹이가 되었고, 다크크롬벨은 그 힘을 이용하여 시간을 지배하는 악마가 되었다.

 

과거로 부하들을 보내 이전쟁을 끝내고 지구를 멸망시키려는 크롬벨...이때를 예상하였던 것일까? 라이제르의 집 지하에서 발견된 시간의 틈새...

 

그리고 이제 라이제르가 남긴 시간의 틈새를 통해 한신우가 과거로 돌아간다. 무너지는 과거를 지키기 위하여, 그리고 남아있는 미래를 지키기 위해서!

 

네이버의 인기 웹툰 노블레스 게임의 사전예약 이벤트소개 입니다.

 

https://youtu.be/yrAd1fU6eek

 

당신의 주식 파트너! 거장들의 투자공식

https://appfing.com/3818873

 

당신의 주식 파트너! 거장들의 투자공식

합리적인 가격에 건전한 투자 서비스를 만나보세요!

appfing.com

합리적인 가격에 건전한 투자 서비스를 만나보세요!

https://youtu.be/itTfGQrF9jI

※ 거장들의 투자공식 서비스 ※

 

주식 초보들을 위한, 주식투자 종합 솔루션 어플 '거장들의  투자공식' 

개인투자자들도 쉽고 재미있게 주식 투자를!

 

 

- 세계적인 투자거장들의 아이디어를 활용한 종목추천

- 이 종목 사도 좋은 종목일까? 투자에 반드시 참고해야 할 종목 재무분석! 

- 내 종목의 일주일 후 수익률은? 인공지능 패턴분석을 통한 주가 수익률 예측!

 

 

※ 거장들의 투자공식 활용법 ※

 

*어느 종목에 투자해야 할지 막막하신 분

 

 ㅁ 세계적인 투자 거장 아이디어와 데이터 과학 기술을 접목시켜 

      한국 주식 시장에 맞게 재해석

 ㅁ 명확하게 구분된 투자 철학과 종목 스타일에 기반한 발굴

   - 가치 투자가: 벤저민 그레이엄, 존 네프

   - 성장 투자가: 피터 린치, 케네스 피

   - 계량 투자가: 조셉 피오트로스키

 ㅁ 고객의 성향에 맞춰 매일 종목을 추천하는 오늘의 종목제안 서비스

 

* 매수를 고려하는 종목에 대한 자가진단이 필요하신 분

 

 ㅁ 투자에 반드시 필요한 지표들만 모았다. 성장성, 안전성, 수익성, 효율성! 

     국내 최다 투자 팩터를 활용해 직관적으로 나타낸 종목의 투자 매력도 점수!

 ㅁ 이 종목은 어떤 점에서 매력적인 종목일까? 동일 업종 다른 종목과도 비교 가능

 ㅁ 주식투자는 타이밍이다! 차트를 통해 타이밍을 제시하는 패턴 검색 서비스 제공

 ㅁ 머신러닝 기법을 통해 과거 종목의 차트 패턴을 분석하여 종목의 매수매도 타이밍 진단

https://youtu.be/WuSdjCtdLk0

 

100만 명이 넘는 엄마들에게 많은 사랑을 받고있는
대한민국 대표 임신/육아 플랫폼 맘스다이어리!

https://play.google.com/store/apps/details?id=com.moms.momsdiary

 

진짜 엄마의 시작, 맘스다이어리

100만 명이 넘는 엄마들에게 많은 사랑을 받고있는 대한민국 대표 임신/육아 플랫폼 맘스다이어리!

appfing.com

 

*엄마들에게 사랑받을 수 밖에 없는 핵심서비스*

[성장앨범 무료출판-맘스북]

사랑스러운 아이와의 추억을 오래오래 간직하는 최고의 방법은 

책으로 출판하는 것입니다. 세상에 단 하나뿐인 엄마표 우리아이의 소중한 역사책!!

이제 맘스다이어리에서 무료로 몇 번이고 출판해 드립니다. 

 

- 매일 10만명 이상의 엄마들이 방문하여 추억을 담고 있는 중

- PC 모바일로 언제 어디서나 아이와의 추억을 남기면 횟수에 제한없이 무료출판

- 올컬러 맞춤 인쇄는 물론 양장제본으로 제작하여 장기간 보관 용이

- 무료로 제작하는 엄마표 성장앨범, 포토북

 

*엄마들이 사랑하고 애용하는 다양한 부가서비스*

[무료 프리미엄 임신&출산 샘플박스 - 맘스팩]

임신과 출산보다 더 많이 축복받아야 할 일이 있을까요?

대한민국 임신부를 응원하고 건강한 출산을 기원합니다!

 

- 매월 200명 선발, 무료로 맘스팩 제공 

- 임신부&출산 100일 이내의 엄마라면 누구나 신청 가능

- 엄마와 아기를 위한 약 20여가지의 다양한 제품들로 구성  

 

[엄마가 편해지는 편의기능 4종 SET-무료 ]

  잠이 솔솔~ 오르골 자장가 / 먹이고 기록하고~ 수유매니저 

  / 아기울음 뚝!! 백색소음 / 피로야 가라~ 힐링사운드

 

[맞춤 임신&육아정보-1,000일 스토리]

  임신280일+육아720일 동안 임신과 육아에 도움이되는 나만의 맞춤 정보를 원하는 시간에 제공

 

[아이와 엄마의 마음 보기-부모자녀 심리검사]

  EBS 표준화심리검사 공식개발사와 3년간 공동연구한 최고의 심리검사 PC/모바일로 

  편하게 검사하면 꼼꼼한 올컬러 맞춤형 보고서를 집으로 배송

 

[매일매일 공동구매, 최저가 쇼핑-맘스쇼핑]

  가격과 혜택이 다르다! 맘스회원 전용 쇼핑몰은 엄마들이 꼭 필요로 하는 제품들을 선별하여 최저가로 제공

 

[알뜰한 육아를 위한 선택-맘스 중고장터]

  불필요한 제품은 쉽게 팔고, 꼭 필요한 제품은 저렴하게 득템하는 중고장터

 

그 외 엄마들이 좋아할 다양한 이벤트와 캠페인이 끊임없이 진행중입니다.

임산부와 육아맘을 위한 필수어플 맘스다이어리! 

지금 다운받고 이용해보세요!

 

https://youtu.be/TlMHrkUoN4Y

 

무료체험이벤트를 진행하는 로제타 스톤 화상영어 어플을 소개해드릴게요.

지난 25년 이상 전세계 교육 기관과 기업, 그리고 개인 고객들의 신뢰를 얻어온 로제타 스톤의 새로운 1:1 미국인 화상 영어 회화를 소개합니다.

https://appfing.com/5227470

 

앱 런칭 기념, 미국인 1:1 화상영어 100분 무료체험 이벤트!

 

appfing.com

미국인처럼 영어로 능숙하고 자신있게 대화하고 싶다면,

언제 어디서나 내가 고른 시간과 주제로 진행되는 화상 대화를 통해 잠들어있는 영어 실력을 깨우세요!

 

[ 로제타 스톤 화상 영어 회화만의 특징]

1. 일회 25분 - 다양한 회화 주제를 가지고 원어민 강사와 직접 대화하며 영어 말하기 자신감 UP! 

 

2. 수백개의 회화 주제 - 비지니스, 일상 생활, 상식 등으로 이루어진 수백개의 회화 주제 자유롭게 선택 가능!

 

3. 100% 미국인 선생님 - 철저한 선발과 교육 과정을 거친 숙련된 언어교육 전문가들로, 말하기 뿐만 아니라 발음 교정, 문법 개선, 어휘력 증대까지 OK!

 

4. 언제 어디서나 쉽게 - 언제 어디서나 쉽게 시작할 수 있으며, 일정이 허락하지 않는 경우 바로 취소 가능!

 

5. 1:1 강사 피드백 - 매 회화 이후 강사의 직접적, 구체적 피드백부터 이후 복습 가능한 단어 및 숙어장, 복습 기능 제공까지!

 

6. 100분 무료체험 -  총 100분, 12만원 상당의 수업 무료체험 이벤트 중!

 

영어회화를 저렴하게 공부하시려는 분들에게 추천드려요.

 

#영어회화 #화상영어 #영어회화어플 #화상영어어플 

 

+ Recent posts