레이블이 gear인 게시물을 표시합니다. 모든 게시물 표시
레이블이 gear인 게시물을 표시합니다. 모든 게시물 표시

2017년 11월 10일 금요일

iOS, Samsung IAP, Unity Overview

iOS IAP


https://developer.apple.com/in-app-purchase/

IAP 대상
 : Content, Subscriptions, New features, Services.

IAP 아이템 종류
Consumable
 : app에서 사용되는 아이템들이 해당되고 구입해서 한번 소비하면 삭제되어 재구매 가능.

Non-Consumable
 : app에서 소비되지 않거나 premium feature 같은 것이 해당되고 구입하면 만료없이 사용 가능.

Auto-Renewable Subscriptions
 : 서비스나 업데이트된 콘텐츠를 주기적으로 구입하는 상황이 해당 됨. (cloud storage 매달 사용, 주간 magazine 배달 받음)
  사용자가 주기적인 구입을 취소하지 않는 한 지정된 기한마다 자동 결재 됨.

Non-Renewing Subscriptions
 : 사용자가 서비스나 콘텐츠를 지정된 기간동안만 사용 가능하고 자동으로 subscription이 갱신되지 않는다.

[Preparing]
- Paid Application Agreement 작성 & banking, tax 정보 입력
- Xcode를 사용하여 app에서 IAP service를 사용하도록 함.
- iTunes Connect에서 상품명, 가격, 설명 등을 작성하여 관리한다.

[Designing and Building]
- IAP store design
- IAP 구현

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Introduction.html#//apple_ref/doc/uid/TP40008267









[Testing]
- Apple sandbox에서 IAP를 영향 없이 테스트 할 수 있음.
- TestFlight를 사용하여 테스터들을 대상으로 IAP을 테스트하고 feedback을 받을 수 있음.


*실제 구현 관련 포스팅
http://korea-developer.tistory.com/entry/iOS-IAPInApp-Purchase

-----------------------------------------------------------------------------------------------

Samsung IAP


Mobile


http://developer.samsung.com/iap
http://developer.samsung.com/html/techdoc/HowToStart_SamsungInAppPurchaseSDK_v3.0.0_KR.pdf



- Samsung In-App Purchase SDK 3.0.1 이상에서는 Android 6.0(Mashmallow) 이상에서 사용 가능
- 그외 버전에서는 Android 4.0 이상에서 사용 가능한것으로 보임
- Payment 방식 :  90개국에서 Credit Card, Phone bill, PayPal 가능
- 삼성 (Galaxy) Device만 지원
- Samsung Gear에서도 Tizen SDK + Extension SDK를 사용해서 IAP 사용가능
- IAP v2.0 : Consumable item, Non-Consumable items, Non-Recurring subscription items.
  IAP v3.0 : Auto-Recurring subscriptions item.
  IAP v5.0 : Item, Subscription으로 정리, Non-Recurring subscription 제거됨.

[API]

Android API : http://developer.samsung.com/iap/guide
Server Side API? : http://developer.samsung.com/iap/developer-api


Gear

http://developer.samsung.com/gear/distribute/iap


- Mobile(Galaxy)와 연동되어 동작하는 것으로 보임.
- Gear에서 사용할 수 있는 API는 상품 목록, 구매, 구입 목록 확인만 있음.

[Gear API]
 . Web : http://img-developer.samsung.com/onlinedocs/gear/web_device/webapis/iap.html
 . Native(C) : http://img-developer.samsung.com/onlinedocs/gear/native/group__CAPI__IAP__GALAXYAPPS__FRAMEWORK.html

[Programming Guide]
 . Web : http://img-developer.samsung.com/onlinedocs/gear/Extension_PG_Web/html/prog_guide/inapp_ww.htm
 . Native(C) : http://img-developer.samsung.com/onlinedocs/gear/Extension_PG_Native/html/prog_guide/inapp_wn.htm


TV


http://developer.samsung.com/tv/tizen-net-tv-preview/guides/samsung-checkout



- Samsung Checkout 을 통해 Samsung TV 상에서 구매 가능.
- 3-step checkout ???
 : 사용자가 구매 수단 등록 (mobile, web)
 : 구매 아이템 정보 확인
 : Remote control로 숫자를 입력하여 구매 진행

- 환경
. TV: Samsung Smart TV, 2015 or later model (excluding Evolution Kit)
. Payment method: Credit or debit card, PayPal, or carrier billing (in Korea)
. Security: Tizen SecureIME, 2nd-screen card registration (mobile or PC)
. Account: Samsung Account (for sharing account and payment information with Galaxy phones)

- 사전 절차
: TV Sellor Office에 app 등록, DPI portal에 Billing 정보 등록 및 코딩
 (DPI(Digital Product Inventory) security key와 service를 사용하여 Purchase 가능

- 주요 기능
: 아이템 목록 확인, 아이템 구매, 구매 목록 확인, 구매 확인, 구매 복구, 구독 취소

[Billing 사용을 위한 Precondition]
- NuGet packages
 : Tizen.TV
 : Tizen.TV.Service.Billing
 : Tizen.TV.Service.Sso

- Privileges
<tizen:privilege name="http://developer.samsung.com/privilege/sso.partner"/>
<tizen:privilege name="http://developer.samsung.com/privilege/productinfo"/>
<tizen:privilege name="http://tizen.org/privilege/appmanager.launch"/>
<tizen:privilege name="http://developer.samsung.com/privilege/billing"/>

- 기타 환경 설정
a. Retrieve the User ID:
using Tizen.TV.Service.Sso;
string loginUid = Sso.GetLoginUid(); //get UID value from TV
b. Retrieve the country code:
using Tizen.TV;
string country = Environment.SmartHubConfig.Country;
c. Retrieve the server type:
using Tizen.TV;
int serverType = Environment.SmartHubConfig.ServerType;
d. Set the service environment:
// Use dummy payment for development
BillingRequestServerType servertype = BillingRequestServerType.Dummy;

// When submitting to Samsung Apps TV, use Sandbox or Live environment depending on the TV environment.
if(serverType == 0) {  // Operating zone
  BillingRequestServerType servertype = BillingRequestServerType.Prd;
} else { // Staging zone
  BillingRequestServerType servertype = BillingRequestServerType.Dev;
}
string securityKey = "**********"; // YOUR SECURITY KEY ISSUED BY DPI PORTA

Sample : https://github.com/SamsungDForum/Xamarin.Billing


-----------------------------------------------------------------------------------------------

Unity IAP 


https://docs.unity3d.com/Manual/UnityIAPSettingUp.html



- 지원 Store (뭐 그냥 다 된다고 보면 된다.)
: Apple App Store, Mac App Store, Google Play Store, Windows Store, Amazon Appstore, Galaxy Store, Tizen Store, CloudMoolah MOO Store

- Product Types
: Consumable, Non Consumable, Subscription (별도로 구분하고 있지는 않는 듯)

- 주요 기능
: IAP 아이템 목록 추가/확인, 아이템 구입,
  구매 목록 복구, 구매 확인, 구매 검증, Store 확장 기능

- Store Extensions
https://docs.unity3d.com/Manual/UnityIAPStoreExtensions.html
: Cross Platform purchase flow에서 처리할 수 없는
 Store의 unique한 process를 처리하도록 만든 Interface.

/// <summary> /// Called when Unity IAP is ready to make purchases. /// </summary> public void OnInitialized (IStoreController controller, IExtensionProvider extensions) { extensions.GetExtension<IAppleExtensions> ().RefreshAppReceipt (result => { if (result) { // Refresh finished successfully. } else { // Refresh failed. } }); }

2015년 10월 8일 목요일

Gear S2 sdb 연결 및 app 설치를 위한 인증서(certificate) 설정

[Gear S2와 개발용 host와 연결]


Gear S2에 app을 설치하기 위해서는 USB port가 없는 관계로  
usb가 아닌 WiFi를 사용하여 Gear S2를 개발용 host(PC, Laptop)와 연결해야 한다.

                         Connect via Wi-Fi

간단히 말하면 Gear에서 debuggin 옵션을 켜고 Reboot 후
BT를 끄고 개발용 host가 연결되어 있는 WiFi망에 Gear를 연결하면 된다.

좀 더 자세한 절차를 기술하자면...

(Gear S2에서)
1. Settings > Gear Info > Debugging ON
2. Reboot
3. Turn Off Bluetooth
4. Turn On Wi-Fi
5. Connect Wireless Router
6. Check IP address in Settings > Wi-Fi networks > connected Wi-Fi detail information

(SDK에서)
7. Open Remote Device Manager
8. New > Name > IP > Add
9. Connect
(Gear S2에서 PC/Laptop 연결을 허용 후)
10. Disconnect > Connect


sdb connect를 사용해도 되고 SDK의 Connection Explorer 중
Remote Device Manager에서 IP를 등록하고 연결 가능함.

(Troubleshooting)

- 혹시나 linux에서 sdb를 직접 설치했다면 그것은 지워버리고 SDK/tools/sdb를 사용하라.

- 개발용 Host(PC/Laptop)은 Wireless Router에 유선(cable)으로 연결되어 있어야 안정적인 연결이 가능하다.

- 개발용 Host나 S2 모두 무선(Wireless)으로 연결되어 있으면 sdb와 연결이 주변 무선 환경에 따라 쉽지 않을 수 있다. 

- 될 때 까지 sdb connect를 시도하고 연결이 된다면 개발용 Host에서 ping을 S2의 IP로 계속 호출해주는 것도 연결을 계속 유지하기 위한 방법일 수 있음.

- sdb connect가 한번에 안될 수도 있다. 그럴 때는 BT가 꺼져있는지와 IP를 확인한 뒤 될 때 까지 시도


아래 samsung developer site에서 Gear 개발 관련된 내용을 찾을 수 있고
관련된내용으로 d.denadai님이 간략히 정리한 내용이다.


http://developer.samsung.com/forum/thread/connecting-gear-s2-with-tizen-ide-/201/285623?boardName=SDK&startId=zzzzz~&searchSubId=0000000032#post1

Developer d.denadai , 9350 Seed Oct 05, 2015 10:18 Post #1 4 Hi!

 To connect your Gear S2 to the IDE on the computer you need to use SDB over the network.
- Connect your Gear S2 to a phone, so it can retrieve the Wi-Fi credentials from the phone;
- Enable debugging in the watch (settings > about);
- Turn the Bluetooth off, so the watch will now try and connect to a Wi-Fi network;
- Connect your pc to the same network;
- Connect SDB via the terminal : sdb connect <IP of the watch>

The watch is now visible from your IDE so you can deploy your application.

Cheers,
Didier 



아래는 좀 더 자세하게 설명하고 있는 설명

Connecting Gear S2 using Wi-Fi
: http://developer.samsung.com/technical-doc/view.do?v=T000000251L


[App 설치를 위한 인증서 설정]


개발 중 Gear S2에 app을 설치하기 위해서는 단말에 맞는 인증서를 설치해야 함.

이제 SDK 설치할 때 옵션으로 설치 가능하다.


2015년 6월 24일 수요일

Android Webview, Gear 상에서의 GPS 개발 관련 정리

[Geolocation API 사용을 위한 Android Webview 설정]


Android Webview 내에서 Geolocation API를 사용하려면 아래와 같은 설정이 필요하다.

참고
http://stackoverflow.com/questions/5329662/android-webview-geolocation


1. Android app에서 location 관련 permission 명시

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />


2. Geolocation API 사용을 위한 Webview 설정

: JavaScript enable, Geolocation enable, Geolocation caching을 위한 DB path 설정
http://developer.android.com/reference/android/webkit/WebSettings.html

webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setGeolocationEnabled(true);
webView.getSettings().setGeolocationDatabasePath(Context.getFilesDir().getPath());


아래 HTML5 관련 설정들은 실제 Geolocation API에 영향을 주는지 확인은 안했지만
사용하는 webview에서 사용하고 있었던 것이라 혹시나 안된다면 아래 것도 추가를..

webView.getSettings().setDatabaseEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setAppCacheEnabled(true);


3. 위치 정보 접근 허용을 위한 알림 및 허용 처리

: 위치정보 접근 허용을 위한 WebChromeClient.onGeolocationPermissionsShowPrompt() 구현
http://developer.android.com/reference/android/webkit/WebChromeClient.html#onGeolocationPermissionsShowPrompt(java.lang.String, android.webkit.GeolocationPermissions.Callback)

아래 예제에서는 그냥 사용자에게 prompt를 보여주지 않고 자동으로 위치정보를 접근하게 한예제이니 사용자에게 알릴 필요가 있다면 여기서 알려야함.

webView.setWebChromeClient(new WebChromeClient() {
 public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
    callback.invoke(origin, true, false);
 }
});


위 방법들을 사용하면 Android webview 내에서 Geolocation API를 사용할 수 있다.


[Geolocation APIs - getCurrentPosition, watchPosition]

: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation

getCurrentPosition, watchPosition에 대한 설명이다.

둘다 위치 정보를 얻기 위해 hardware를 사용하므로 비동기적(asynchronous)으로 callback을 통해 결과를 전달하는 것은 동일하지만 getCurrentPosition은 일회적으로 현재 위치를 제공하는 것이고 watchPosition은 위치의 변화가 있을 경우 변경된 좌표를 제공한다는 것이 다른 점이다.
또한 아래 설명의 굵은 글씨들을 참고하면 watchPosition이 이전 좌표를 기반하여 별도의 기술을 사용하여 좀 더 정확한 좌표를 제공하려 하는 것 같다. 아마도 Android webview에서 database path를 설정하는 것도 이런 연유에서일 것으로 추측..
하지만 watchPosition은 위치 변화 뿐만아니라 좀 더 정확한 위치가 설정 되어도 알려줘서 모르겠지만 수신 받은 위치를 좀 걸러내야 할 필요성이 있는 것 같다. 특히 GPS + 네트워크 둘다 사용할 경우 종종 부정확한 위치가 전달 된다.

(발췌, MDN Using Geolocation )

Getting the current position

To obtain the user's current location, you can call the getCurrentPosition() method. This initiates an asynchronous request to detect the user's position, and queries the positioning hardware to get up-to-date information. When the position is determined, the defined callback function is executed. You can optionally provide a second callback function to be executed if an error occurs. A third, optional, parameter is an options object where you can set the maximum age of the position returned, the time to wait for a request, and if you want high accuracy for the position.


Watching the current position

If the position data changes (either by device movement or if more accurate geo information arrives), you can set up a callback function that is called with that updated position information. This is done using the watchPosition() function, which has the same input parameters as getCurrentPosition(). The callback function is called multiple times, allowing the browser to either update your location as you move, or provide a more accurate location as different techniques are used to geolocate you. The error callback function, which is optional just as it is for getCurrentPosition(), can be called repeatedly.


이와 비슷한 내용의 Answer와 예제 샘플은 다음과 같다.

watchPosition API 사용 샘플
watchPosition을 계속 실행하면 아무래도 GPS 관련 hardware를 계속 사용하게 되므로 일정시간 watchPosition을 사용하되 몇초 단위로 끊어서 사용하고 있음.
: http://stackoverflow.com/questions/8552186/how-to-get-html5-position-in-webview-updated-at-a-regular-interval-with-fine-ac


Platform, OS 별 Geolocation 사용 예제
: http://docs.phonegap.com/en/edge/cordova_geolocation_geolocation.md.html

HTML5 Geolocation API 표준 문서
: http://www.w3.org/TR/geolocation-API/#geolocation_interface

이것도 참고하시라...
: http://www.andygup.net/how-accurate-is-html5-geolocation-really-part-2-mobile-web/


[Gear에서의 GPS 사용]



- GPS feature를 제공하는 제품들은 Gear2 neo, GearS가 있는 것으로 알고 있지만
   Gear 2에서는 Geolocation API를 사용할 수 없다. (Tizen 2.3 기준)

 . 그래서 GPS 센서가 없는 모델들은 SAP(Samsung Accessory Protocol)을 사용해서 mobile의 GPS 좌표를 사용하더라..
 (http://www.codeproject.com/Articles/830305/Speedometer-for-Galaxy-Gear-Tizen-Based)


- GearS는 GPS 센서가 있지만 GPS 센서, 네트워크 위치를 사용해서 위치를 파악한다.
 . GPS 센서만 사용하고자 한다면 설정 > 연결 > GPS만 사용 에 체크

 . FakeGPS를 사용하여 GearS GPS app디버깅 방법
  : SIM 카드가 없는 상태에서 설정 > 연결 > GPS만 사용 체크 해제
    GearS와 연결된 mobile의 GPS 끄고 fake GPS로 GPS 좌표 설정
    다만 Gear GPS센서가 동작이 안되는 상태에서 가능하므로 실내에서 가능하다..


[T map OpenAPIs]



https://developers.skplanetx.com/apidoc/kor/tmap/

타 통신사에서는 그림의 떡같은 T map인 관계로 별로 좋아하지 않았지만
이번에 Geolocation 관련 API을 찾다 보니 감사하게도 Open API들을 제공하고 있었다.
제공되는 API들도 꽤나 다양해서 GPS app 개발 시 상당히 유용할 것으로 보인다.

REST API를 사용해서 몇개를 사용해 봤는데 아래 사항은 지켜야 정상 응답을 하더라.

- url에서 callback, gizAppId는 값이 없어도 파라미터로 존재해야 한다.

예를 들어 경로 안내 API를 사용하려면
: https://developers.skplanetx.com/apidoc/kor/t-map/course-guide/geojson/

https://apis.skplanetx.com/tmap/routes?version=1&bizAppId={bizAppId}&callback={callback}

위와 같은 URL을 사용해야 하는데 bizAppId와 callback은 optional 항목이다.
하지만 bizAppid와 callback을 생략하고 ?version=1 만 적으면 정상 응답이 오지 않더라.
?bizAppId=&callback=&version=1 이렇게 적어 호출하니 정상응답.


- content type 설정

REST API 호출(HTTP request시) content type을 "Content-Type: application/x-www-form-urlencoded"로 설정해야 해서 jquery의 $.ajax()를 사용 시 header param으로 명시해야 한다.