'유니티/스크립트'에 해당되는 글 123건

  1. 2014.04.18 Animation and Follow Camera
  2. 2014.04.14 하이브리드 app - 1일차
  3. 2014.04.10 c#의 콜백함수란?
  4. 2014.04.10 유니티 event delegate 예제 (1)
  5. 2014.04.08 PlayerPrefs 배열로 저장하기.
  6. 2014.04.08 NGUI 스크롤뷰 grid 아이템 생성시 순서대로 생성되게 하기.
  7. 2014.04.02 유니티 안드로이드 확장 개발 - jar 파일(이클립스연동) (3)
  8. 2014.03.28 인앱빌링 구현하기 ver3 - 구글번역
  9. 2014.03.27 안드로이드 서버 php 통신(간단히) (11)
  10. 2014.03.18 유니티 xml 파일 로드

Animation and Follow Camera

|























'유니티 > 스크립트' 카테고리의 다른 글

Combat System2  (0) 2014.04.18
Combat System 1  (0) 2014.04.18
Animation and Follow Camera  (0) 2014.04.18
하이브리드 app - 1일차  (0) 2014.04.14
c#의 콜백함수란?  (0) 2014.04.10
유니티 event delegate 예제  (1) 2014.04.10
Trackback 0 And Comment 0

하이브리드 app - 1일차

|



http://job.moiba.or.kr/

중소기업 청년취업인턴제

(립모션, 키넥트)

증강현실 관련 최종 결과물

 

유니티의 기초(자바스크립트 기반의로 교육을 하네요)

 

아이디어 도출과정

 

관찰 -> 패턴인식, 패턴형성 -> 유추 유사성 or ? -> 추상화 -> 단순화 -> 형상화 -> 표현

 

fixed idea kills your brain(고정관념은 당신이 머리를 죽인다)

 

중간중간 영상자료를 보여줌

 

유니티의 기본적인 구성

 

project

scene

Game Object

Components

Asets

Package -> 상품

Prefab -> 붕어빵 기계랑 비슷

Scripts -> 프로그래밍

 

 

 

 


 

유니티 기본 패키지

 

Character Controller -> 캐릭터를 제어하는 예제, 1인칭 및 3인칭 컨트롤러 제공. 키보드 및 마우스 input 값 설정

Glass Refraction(프로버전만가능) -> 세이더의 grab pass를 사용 함 스테인리스 글라스 뒤에 있는 이미지를 굴절시켜 보여줌

Image Effect(프로버전만가능) -> 최종 영상에 효과를 주는 포스트 이미지 이펙트가 모인 예제 매우 다양한 이미지 이펙트를 제공 해줌

Light Coolies -> 광원에 마스크를 씌어 여러가지 효과를 내는 기능. 이러한 마스크를 쿠키라고함.

Light Falres -> 카메라에 밝은 빛을 비출때 생기는 굴절 효과를 제공 여러가지 효과를 제공 함

Particels -> 파티클 시스템을 사용해 표현한 다양한 예제를 제공(나중에 무료로 제공하는 파티클을 찾아 실습)

Physic Materials -> 물리효과

Scripts -> 몇가지 기능들을 제공

 

SKyBox -> 하늘과 같은 주위 환경을 구성하는데 사용 가상의 큰 큐브를 만들고 단면을 붙여 하늘을 표현 여라기지 하늘 효과(노을,구름,맑음, 밤)을 제공

Standard Assets(mobile) -> 스마트 폰 앱 제작에 필요한 기능을 제공, 저 사양에 맞는 기능들

Terrain Assets -> 지형 시스템을 만들 때 사용되는 나무, 풀 등을 제공, 공간을 구성할 때 유용하게 쓰임, 유니티 에셋 스토어에서 더욱 많은 에셋들이 있음

Toon Shading -> 만화처럼 물체를 보여주게 만드는 세이딩 효과를 제공

Tree Creator-> 나무 생성기 기능에서 사용할수 있는 몇가지 에셋

Wator - > 물 효과

 

 

 


간단한 발란스 게임

 

#pragma strict

var rotate_speed : int = 30;

function Start () {

}

function Update () {
 transform.rotation *=
  Quaternion.AngleAxis(Input.GetAxis("Horizontal") *
   rotate_speed * Time.deltaTime,
   Vector3(0,0,1)); 
}

 

 

 


 

 

 

미로찾기나. 젠가? 등등 만들 예정

 

 

 

 

 

 

 

 

 

 

 

 


 

 

 

9시 -> 오티

10시 -> 강사소개

11시 -> 아이디어 도출 관련

12시 -> 유니티 설치

1~6시 -> 유니티 기초 교육

 

 

 

'유니티 > 스크립트' 카테고리의 다른 글

Combat System 1  (0) 2014.04.18
Animation and Follow Camera  (0) 2014.04.18
하이브리드 app - 1일차  (0) 2014.04.14
c#의 콜백함수란?  (0) 2014.04.10
유니티 event delegate 예제  (1) 2014.04.10
PlayerPrefs 배열로 저장하기.  (0) 2014.04.08
Trackback 0 And Comment 0

c#의 콜백함수란?

|
using System;
using System.Runtime.InteropServices;

public delegate bool CallBack(int hwnd, int lParam);

public class EnumReportApp
{
    [DllImport("user32")]
    public static extern int EnumWindows(CallBack x, int y); 

    public static void Main() 
    {
        CallBack myCallBack = new CallBack(EnumReportApp.Report);
        EnumWindows(myCallBack, 0);
    }

    public static bool Report(int hwnd, int lParam)
    { 
        Console.Write("Window handle is ");
        Console.WriteLine(hwnd);
        return true;
    }
}


example 0)
void (*p_func)(char *) = NULL;
extern void my_print(char *s);
void test(char *s)
{
    p_func = my_print;
    p_func(s):

}

example 1)

float Plus    (float a, float b) { return a+b; }
float Minus   (float a, float b) { return a-b; }
float Multiply(float a, float b) { return a*b; }
float Divide  (float a, float b) { return a/b; }

float Calculate(float a, float b, float (*p_Function)(float, float))
{
   float result = p_Function(a, b);
   return result;
}

int main(void)
{
    Calculate(10, 20, &Plus);
    return 0;
}


example 2)
typedef struct
{
  void(*callback_fn)(void);
}
 test_callback_t;

extern void test1();
extern void test2()

void test(void)
{
  test_callback_t callback[2];
  /*원래는 함수이름 앞에 &를 붙이는 것이 더 정확하고 이식성이 좋다*/
  callback[0].callback_fn = test1;
  callback[1].callback_fn = test2;
  /*Call callbacks*/

  callback[0].callback_fn();
  callback[1].callback_fn();

  return;
}





콜백은 함수를 직접 호출하지 않고 다른 함수가 대신 호출하게 하는 것입니다.


 typedef struct 
    {
        int number;
        const char* name;
    } S;

    int cmp_by_number(const void* p1, const void* p2)
    {
        const S* ps1 = p1;
        const S* ps2 = p2;
        return ps1->number - ps->number;
    }

    int cmp_by_name(const void* p1, const void* p2)
    {
        const S* ps1 = p1;
        const S* ps2 = p2;
        return strcmp(ps1->name, ps2->name);
    }

    S array[10];
    qsort(array, 10, sizeof(S), cmp_by_number); // number 순으로 정렬
    qsort(array, 10, sizeof(S), cmp_by_name);   // name 순으로 정렬

qsort 입장에서는 주어진 데이터를 어떻게 정렬할지 미리 알 수는 없으므로
qsort를 호출하는 쪽에서 "이런 방법으로 정렬하라"는 정보를 콜백을 통해
알려주는 것입니다.



이것도 콜백의 일종이라고 볼 수 있겠지요. 만약 call_back_func_1,... 등이
여러 개 있고 test_func에서 호출할 함수를 미리 결정할 수 없다면 함수포인터를
이용한 콜백이 좋은 방법입니다. 예를 들어
void call_back_func_1(int a);
void call_back_func_2(int a);

int answer;
switch (answer)
{
case 1:
     test_func(call_back_func_1, answer);
     break;
case 2:
     test_func(call_back_func_2, answer);
     break;
}







http://msdn.microsoft.com/ko-kr/library/ms173171.aspx




Trackback 0 And Comment 0

유니티 event delegate 예제

|


버튼을 누르면 해당 오브젝트 삭제


Trackback 0 And Comment 1
  1. BlogIcon 2014.04.14 11:12 address edit & del reply

    대다나다

PlayerPrefs 배열로 저장하기.

|

데이터가 int[] _data 안에 들어 있다고 가정하겠습니다. 
string _tmpStr = ""; 

for (int i = 0; i < _data.Length;i ++) { 
  _tmpStr = _tmpStr + _data[i]; 
  if (i < _data.Length) { 
      _tmpStr = _tmpStr + ","; 
  } 


PlayerPrefs.SetString("Data", _tmpStr);로 보존 합니다. 
불러 올때는 string[] _dataArr = PlayerPrefs.GetString("Data").Split(','); 하신후 
int[] _dataIn = new int[_dataArr.Length]; 
for (int i = 0; i < _dataArr.Length; i++) { 
  _dataIn[i] = System.Convert.ToInt32(_dataArr[i]); 

하시면 될 듯 합니다.

Trackback 0 And Comment 0

NGUI 스크롤뷰 grid 아이템 생성시 순서대로 생성되게 하기.

|

NGUI 스크롤 뷰에서 아이템이 생성될때 먼저 생성된 아이템이 맨 밑으로 정렬됨.





UIGrid 에서 sorted 를 누르면 먼저 생성된 아이템이 맨 위로 생성되는 것을 볼수 있다.

다른 옵션들도 많을듯.


Trackback 0 And Comment 0

유니티 안드로이드 확장 개발 - jar 파일(이클립스연동)

|

유니티는 다양한 에셋들을 사용해서 개발의 편의성을 높이고 있습니다.

Prime31이나 각종 애드몹 관련 플러그인들도 이와 같이 개발의 편의성을 높이는 플러그인입니다. 이런 플러그인을 직접 돈주고 사면 좋겠지만.

저희 같은 가난한 개발자 및 학생들은 직접 유니티와 자바의 연동을 통해서 구현해야됩니다. 


여기서는 자바 클래스와 연동하는 방법을 간단하게 소개하겠습니다.


각각 호출할때 기본적인 함수들이 있습니다.


유니티에서는 자바 클래스를 호출할때

AndroidJavaObject.Call 로 자바 클래스의 함수를 호출할수 있습니다.


자바클래스에서 유니티를 호출할때는

UnityPlayer.UnitySendMessage 함수를 사용하여 호출합니다.


유니티로 제작된 게임을 자바 클래스를 통해 확장하는 방식은 2가지가 있는데

첫번째 방식은 자바 클래스를 별도로 제작한 후 유니티 프로젝트 폴더의 Plugins/Android 폴더에 올려서 확장하는 방식이고

두번째 방식은 유니티 내에서 이클립스로 export해주어서 확장하는 방법입니다.


jar 파일을 생성해서 관리하는것이 좀더 편한것 같으니 첫번째 방식을 사용하겠습니다.


먼저 jar 파일을 생성할 프로젝트를 이클립스에서 생성해줍니다.







패키지 이름을 com.test.androidjartest 로 지정했는데 유니티 내의 Bundle Identifier 항목과 일치해야됩니다.


Edit - Project Settings - Player 에서

안드로이드 모양의 버튼을 누르면 Bundle Identifiire 를 수정할수 있습니다. 위에서 만든 패키지 이름과 일치 시켜줍니다.


이클립스에서 프로젝트를 생성하고 난다음에는 유니티가 제공하는 jar 파일을 임포트 해주어야 유니티가 제공해주는 함수를 사용할수 있습니다.


유니티가 제공하는 jar 파일은 classes.jar 파일이며 경로는 설치된 폴더에서 Editor/Data/PlaybackEngines/androidplayer/bin 폴더에 존재합니다.






jar 파일을 추가하는 방법은 프로젝트 폴더에서 오른쪽 버튼을 누르고 properties 를 누릅니다.

그리고 JaVa Build Path 에서 Libraries 에서 Add External JARs 버튼을 누르고 해당 경로에 있는 jar 파일은 선택해주고

Order and Export 에서 불러온 jar 파일을 체크해주고 ok를 누릅니다.





이클립스에서 만들어진 MainActivity 를 위와 같이 고쳐줍니다. 소스를 모두 수정하면 이 소스를 jar 파일로 만들어 exprot 해주겠습니다.






프로젝트 폴더에서 오른쪽 버튼을 누르고 Exprot 를 클릭해줍니다. 그리고 위 처럼 Jar file을 누르고 next 버튼을 눌러주고

자신의 프로젝트에서 src 폴더만 체크 해주고 Jar File 의 이름을 설정해주고 finish 버튼을 누르면 jar 파일이 완성됩니다.





이제 유니티로 넘어오겠습니다.


유니티 내에서는 jar 파일을 인식하기 위해서는 반드시 해당 경로에 jar 파일이 존재해야됩니다. 안드로이드 같은 경우네는

Plugins/Android 폴더에 jar 파일이 존재해야됩니다.


그리고 해당 jar 파일을 실행하기 위해서는 AndoridManifest 및 res 폴더가 필요하므로 위에서 만든 

jar 파일과 res 폴더 AndroidManifest 파일들을 Android 폴더에 집어 넣어줍니다.






이제 모든 세팅이 완료 되었습니다.



이제 제대로 유니티에서 -> 자바 클래스로 자바 클래스에서 유니티로 함수가 호출되는지 보겠습니다.


빈게임 오브젝트를 만들고 AndroidManager로 이름을 변경합니다.(반드시 AndroidManager로 지어주어야 됩니다.)


그리고 AndroidManager 에 아래 스크립트를 할당해줍니다.





AndroidManager 내의 Start 함수에서 MainActivity 자바 클래스의 HelloFunction 함수를 호출(_activity,Call("HelloFunction)하고,

자바 클래스에서는(이클립스) AndroidManage 클래스의 AndroidLog 함수를 호출(UnityPlayer.UnitySendMessage("AndroidManager", "AndroidLog", "Hello!");)하는 구조입니다.



할당후 안드로이드 단말기에서 빌드를 하면 아래와 같이 로그를 출력할 것입니다.






Trackback 0 And Comment 3
  1. Hello 2014.08.04 17:17 address edit & del reply

    AndroidManager.cs 말고 AndroidManager_Test.cs 로 만들면 안되는 이유가 뭐죠?>

    • Favicon of https://hyunity3d.tistory.com BlogIcon 히아레인 2014.08.04 22:03 신고 address edit & del

      MainActivity 보시면 unitysendMessage 함수에서 해당 게임오브젝트 명을 입력해야됩니다 AndroidManager_Test 라고 입력해보세요

  2. Ku 2014.10.21 23:04 address edit & del reply

    실행하였다니 아래와 같은 오류가 발생하였습니다 ㅠㅠ 왜인지 감이 안옵니다 ㅠㅠㅠㅠㅠㅠ
    Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
    C:\Users\kyoungku\Desktop\Company\adt\sdk\build-tools\android-4.4W\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/Users/kyoungku/Desktop/Company/adt/sdk/platforms/android-20\android.jar" -F bin/resources.ap_

    stderr[
    res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
    res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
    res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
    ]
    stdout[
    Configurations:
    (default)
    v11
    v14
    hdpi
    mdpi
    xhdpi
    xxhdpi
    w820dp

    Files:
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    drawable\ic_launcher.png
    Src: (hdpi) res\drawable-hdpi\ic_launcher.png
    Src: (mdpi) res\drawable-mdpi\ic_launcher.png
    Src: (xhdpi) res\drawable-xhdpi\ic_launcher.png
    Src: (xxhdpi) res\drawable-xxhdpi\ic_launcher.png
    layout\activity_main.xml
    Src: () res\layout\activity_main.xml
    menu\main.xml
    Src: () res\menu\main.xml
    values\dimens.xml
    Src: () res\values\dimens.xml
    Src: (w820dp) res\values-w820dp\dimens.xml
    values\strings.xml
    Src: () res\values\strings.xml
    values\styles.xml
    Src: () res\values\styles.xml
    Src: (v11) res\values-v11\styles.xml
    Src: (v14) res\values-v14\styles.xml
    AndroidManifest.xml
    Src: () AndroidManifest.xml

    Resource Dirs:
    Type drawable
    drawable\app_icon.png
    Src: () res\drawable\app_icon.png
    drawable\ic_launcher.png
    Src: (hdpi) res\drawable-hdpi\ic_launcher.png
    Src: (mdpi) res\drawable-mdpi\ic_launcher.png
    Src: (xhdpi) res\drawable-xhdpi\ic_launcher.png
    Src: (xxhdpi) res\drawable-xxhdpi\ic_launcher.png
    Type layout
    layout\activity_main.xml
    Src: () res\layout\activity_main.xml
    Type menu
    menu\main.xml
    Src: () res\menu\main.xml
    Type values
    values\dimens.xml
    Src: () res\values\dimens.xml
    Src: (w820dp) res\values-w820dp\dimens.xml
    values\strings.xml
    Src: () res\values\strings.xml
    values\styles.xml
    Src: () res\values\styles.xml
    Src: (v11) res\values-v11\styles.xml
    Src: (v14) res\values-v14\styles.xml
    Including resources from package: C:\Users\kyoungku\Desktop\Company\adt\sdk\platforms\android-20\android.jar
    applyFileOverlay for drawable
    applyFileOverlay for layout
    applyFileOverlay for anim
    applyFileOverlay for animator
    applyFileOverlay for interpolator
    applyFileOverlay for transition
    applyFileOverlay for xml
    applyFileOverlay for raw
    applyFileOverlay for color
    applyFileOverlay for menu
    applyFileOverlay for mipmap
    Processing image: res\drawable\app_icon.png
    Processing image: res\drawable-hdpi\ic_launcher.png
    Processing image: res\drawable-mdpi\ic_launcher.png
    Processing image: res\drawable-xhdpi\ic_launcher.png
    (processed image res\drawable-mdpi\ic_launcher.png: 82% size of source)
    Processing image: res\drawable-xxhdpi\ic_launcher.png
    (processed image res\drawable-hdpi\ic_launcher.png: 77% size of source)
    (processed image res\drawable\app_icon.png: 94% size of source)
    (processed image res\drawable-xhdpi\ic_launcher.png: 74% size of source)
    (processed image res\drawable-xxhdpi\ic_launcher.png: 72% size of source)
    (new resource id app_icon from drawable\app_icon.png #generated)
    (new resource id ic_launcher from hdpi\drawable\ic_launcher.png #generated)
    (new resource id ic_launcher from mdpi\drawable\ic_launcher.png #generated)
    (new resource id ic_launcher from xhdpi\drawable\ic_launcher.png #generated)
    (new resource id ic_launcher from xxhdpi\drawable\ic_launcher.png #generated)
    (new resource id activity_main from res\layout\activity_main.xml)
    (new resource id main from res\menu\main.xml)
    ]

인앱빌링 구현하기 ver3 - 구글번역

|

Implementing In-app Billing (IAB Version 3)

구글 플레이에 인앱 결제는 인앱 결제 요청을 전송하고 구글은 재생 사용하여 응용 프로그램 내 결제 트랜잭션을 관리하기위한 간단, 간단한 인터페이스를 제공합니다. 아래 정보는 버전 3 API를 사용하여 앱내 결제 서비스 응용 프로그램에서 호출을하는 방법의 기초를 다룹니다.

Note: 완전한 구현을 확인하고 응용 프로그램을 테스트하는 방법에 대해, 인 - 앱 판매 제품 교육 클래스를 참조하십시오.교육 과정은 당신의 연결을 설정하는 구글 플레이에서 결제 요청과 응답의 처리를 보내, 당신은 인 - 앱 결제를 할 수 있도록 배경 스레드 관리와 관련된 주요 작업을 처리 할 수있는 편리한 클래스를 포함하는 전체 샘플 앱 결제 응용 프로그램을 제공합니다 main Activity 에서 호출합니다.

당신이 시작하기 전에, 당신은 쉽게 당신이 인 - 앱 결제를 구현할 수 있도록합니다 개념에 익숙해 앱내 결제 개요를 읽을 수 있는지 확인하십시오.

 응용 프로그램에 위치한 앱 결제를 구현하려면 다음을 수행해야합니다 :

  1. 프로젝트에 앱내 결제 라이브러리를 추가합니다.
  2. 여러분의 AndroidManifest.xml 파일을 업데이트합니다.
  3. ServiceConnection를 만들고 IInAppBillingService에 바인딩합니다.
  4. 응용 프로그램 toIInAppBillingService에서 인 - 앱 결제 요청을 보낼 수 있습니다.
  5. 구글 플레이에서 인 - 앱 결제 응답을 처리합니다.

프로젝트에 AIDL 파일을 추가


IInAppBillingService.aidl은 인 - 앱 과금 버전 3 서비스에 대한 인터페이스를 정의하는 안드로이드 인터페이스 정의 언어 (AIDL) 파일입니다. 당신은 IPC 메서드 호출을 호출하여 결제 요청을 할이 인터페이스를 사용합니다.

AIDL 파일을 얻으려면 :

  1. Android SDK Manager 엽니다.
  2. SDK Manager에 expand the Extras 을 선택합니다.
  3. Google Play Billing Library 을 선택합니다..
  4. 다운로드를 완료하기 위해 패키지 설치를 클릭합니다.

IInAppBillingService.aidl 파일은 다음 경로에 설치됩니다.  <sdk>/extras/google/play_billing/.

프로젝트에 AIDL를 추가하려면 :

  1. 안드로이드 프로젝트에 IInAppBillingService.aidl 파일을 복사합니다.
    • 이클립스를 사용한다면:
      1. If you are starting from an existing Android project, open the project in Eclipse. If you are creating a new Android project from scratch, click File > New > Android Application Project, then follow the instructions in the New Android Application wizard to create a new project in your workspace.
      2. In the /src directory, click File > New > Package, then create a package namedcom.android.vending.billing.
      3. Copy the IInAppBillingService.aidl file from <sdk>/extras/google/play_billing/ and paste it into the src/com.android.vending.billing/ folder in your workspace.
    • 이클립스가 아닌 다른 환경을 사용한다면: Create the following directory/src/com/android/vending/billing and copy the IInAppBillingService.aidl file into this directory. Put the AIDL file into your project and use the Ant tool to build your project so that theIInAppBillingService.java file gets generated.
  2. 응용 프로그램을 빌드합니다. 당신은 당신의 프로젝트의 / gendirectory에 IInAppBillingService.java라는 생성 된 파일을 볼 수 있습니다.

Updating Your Application's Manifest


인앱 결제는 구글이 응용 프로그램과 구글 플레이 서버 사이의 모든 통신을 처리하는 응용 프로그램을 재생에 의존합니다.구글 재생 응용 프로그램을 사용하려면 응용 프로그램이 적절한 권한을 요청해야합니다. 당신은 당신의 AndroidManifest.xml 파일에 com.android.vending.BILLING 권한을 추가하여이 작업을 수행 할 수 있습니다. 응용 프로그램이 앱내 결제 권한이 있지만, 결제 요청을 보내려고 시도를 선언하지 않는 경우, 구글의 플레이는 요청을 거부하고 오류로 응답합니다.

To give your app the necessary permission, add this line in your Android.xml manifest file:

<uses-permission android:name="com.android.vending.BILLING" />

Creating a ServiceConnection


응용 프로그램은 응용 프로그램과 구글 플레이 사이의 메시징을 촉진하기 ServiceConnection이 있어야합니다. 최소한 응용 프로그램은 다음을 수행해야합니다 :

  • IInAppBillingService에 바인딩합니다.
  • 구글 응용 프로그램을 재생하려면 (IPC 메서드 호출 등)의 결제 요청을 보낼 수 있습니다..
  • 각 대금 청구 요청과 함께 반환되는 동기 응답 메시지를 처리 할 수 ​​있습니다.

Binding to IInAppBillingService

구글 플레이에 앱내 결제 서비스와의 연결을 설정하려면, IInAppBillingService에 활동을 결합하는 ServiceConnection를 구현합니다.연결이 설정된 후 IInAppBillingService 인스턴스에 대한 참조를 얻을 수있는 onServiceDisconnected 및 onServiceConnected 방법을 재정의합니다. 

IInAppBillingService mService;

ServiceConnection mServiceConn = new ServiceConnection() {
   
@Override
   
public void onServiceDisconnected(ComponentName name) {
       mService
= null;
   
}

   
@Override
   
public void onServiceConnected(ComponentName name,
     
IBinder service) {
       mService
= IInAppBillingService.Stub.asInterface(service);
   
}
};

귀하의 활동의에서 onCreate 메서드에서 bindService 메서드를 호출하여 바인딩을 수행합니다.앱내 결제 서비스 및 사용자가 만든 ServiceConnection의 인스턴스를 참조하는 방법 anIntent을 전달합니다.

@Override
public void onCreate(Bundle savedInstanceState) {    
   
super.onCreate(savedInstanceState);
    setContentView
(R.layout.activity_main);        
    bindService
(new
       
Intent("com.android.vending.billing.InAppBillingService.BIND"),
                mServiceConn
, Context.BIND_AUTO_CREATE);

이제 구글 플레이 서비스와 통신하는 mService 참조를 사용할 수 있습니다. 위 해당 함수 같은 경우

구글 샘플 ver3 IAPHelper 클래스에 정의 되있음.


Important: 당신이 당신의 활동을 완료하면 앱내 결제 서비스에서 바인딩을 해제해야합니다. 당신이 바인딩을 해제하지 않을 경우, 오픈 서비스 연결 장치의 성능이 저하 될 수 있습니다. 이 예제에서는 활동의들의 OnDestroy 메서드를 재정 의하여 mServiceConn라는 앱내 결제에 대한 서비스 연결에 바인딩 해제 작업을 수행하는 방법을 보여줍니다.

@Override
public void onDestroy() {
   
super.onDestroy();
   
if (mService != null) {
        unbindService
(mServiceConn);
   
}  
}

IInAppBillingService에 결합 서비스 연결의 전체 구현을 위해, 인 - 앱 판매 제품 교육 클래스 및 관련 샘플을 참조하십시오.

Making In-app Billing Requests


응용 프로그램이 구글 플레이에 연결 한 후에는 응용 프로그램 내 제품의 구매 요청을 시작할 수 있습니다. 구글 플레이는 사용자가 자신의 지불 방법을 입력 할 수있는 체크 아웃 인터페이스를 제공하여 응용 프로그램이 직접 지불 트랜잭션을 처리 할 필요가 없습니다.항목이 구입되면, 구글의 플레이는 사용자가 해당 항목의 소유권을 가지고 있으며, 그것이 소비 될 때까지 동일한 제품 ID와 다른 아이템을 구입하는 사용자를 방지 함을 인식합니다. 당신은 항목이 응용 프로그램에서 소비되는 방법을 제어하고, 구글은 다시 구입을위한 항목을 사용할 수 있도록 재생 알릴 수 있습니다. 또한 구글은 사용자가 빠르고 만들어진 구매 목록을 검색 재생 조회 할 수 있습니다. 당신은 당신의 사용자가 응용 프로그램을 시작할 때 사용자의 구매를 복원하려는 경우에 유용합니다.

Querying for Items Available for Purchase

응용 프로그램에서, 당신은 앱내 결제 버전 3 API를 사용하여 Google 플레이에서 항목 상세 정보를 조회 할 수 있습니다. 먼저 각 문자열이 살 수있는 항목에 대한 제품 ID입니다 키 "ITEM_ID_LIST"와 제품 ID의 문자열 ArrayList에 포함 된 번들을 작성, 인 - 앱 결제 서비스에 대한 요청을 전달합니다.

ArrayList<String> skuList = new ArrayList<String> ();
skuList
.add("premiumUpgrade");
skuList
.add("gas");
Bundle querySkus = new Bundle();
querySkus
.putStringArrayList(“ITEM_ID_LIST”, skuList);

구글 플레이에서이 정보를 검색 앱내 결제 버전 3 API에 getSkuDetails의 메서드를 호출하는 방법에게 인 - 앱 결제 API 버전 ( "3")를 전달하려면, 당신의 전화 응용 프로그램, 구입 형태의 패키지 이름 ( "inapp"), 당신이 만든 번들.

Bundle skuDetails = mService.getSkuDetails(3, 
   getPackageName
(), "inapp", querySkus);

만약 결과가 성공하면 리턴해준다. BILLING_RESPONSE_RESULT_OK (0) 값을.

Warning: 주 스레드에 getSkuDetails 메서드를 호출하지 마십시오. 이 메서드를 호출하면 주 스레드를 차단할 수있는 네트워크 요청을 트리거합니다. 대신, 별도의 스레드를 만들고 해당 스레드 내부에서 getSkuDetails 메서드를 호출합니다.

구글 플레이에서 가능한 모든 응답 코드를 참조하십시오 인 - 앱 결제 참조 (영문)를 참조하십시오. 

조회 결과가 키 DETAILS_LIST의 String ArrayList에 저장됩니다.구매 정보는 JSON 형식의 문자열에 저장됩니다. 반환되는 제품 상세 정보의 종류를 확인하려면, 앱 결제 참조를 참조하십시오. 

이 예에서 skuDetails 번들에서 - 응용 프로그램 항목에 대한 가격을 검색하는 이전의 코드에서 반환.

int response = skuDetails.getInt("RESPONSE_CODE");
if (response == 0) {
   
ArrayList<String> responseList
     
= skuDetails.getStringArrayList("DETAILS_LIST");
   
   
for (String thisResponse : responseList) {
     
JSONObject object = new JSONObject(thisResponse);
     
String sku = object.getString("productId");
     
String price = object.getString("price");
     
if (sku.equals("premiumUpgrade")) mPremiumUpgradePrice = price;
     
else if (sku.equals("gas")) mGasPrice = price;
   
}
}

Purchasing an Item

앱에서 구매 요청을 시작하려면 앱내 결제 서비스에 getBuyIntent 메서드를 호출합니다. 메서드에 전달하는 인 - 앱 결제 API 버전 ( "3"), 사용자 통화 앱, 구매하는 품목에 대한 제품 ID의 패키지 이름, 구입 형태 ( "inapp"또는 "서브") 및 developerPayload 문자열입니다.developerPayload 문자열은 사용자가 구글의 구매 정보와 함께 다시 보낼 플레이 할 추가 인수를 지정하는 데 사용됩니다.

Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(),
   sku
, "inapp", "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ");

요청이 성공하면, 반환 된 번들은 당신이 구입 흐름을 시작하는 데 사용할 수있는 BILLING_RESPONSE_RESULT_OK (0) 및 aPendingIntent의 응답 코드가 있습니다. 구글 플레이에서 가능한 모든 응답 코드를 참조하십시오 인 - 앱 결제 참조 (영문)를 참조하십시오. 다음으로, 키 BUY_INTENT와 응답 번들에서 PendingIntent의 압축을 풉니 다.

PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");

구매 거래를 완료하려면 startIntentSenderForResult 메서드를 호출하고 사용자가 만든 PendingIntentthat를 사용합니다. 이 예에서, 요청 코드 (1001)의 임의의 값을 사용하고있다.

startIntentSenderForResult(pendingIntent.getIntentSender(),
   
1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
   
Integer.valueOf(0));

구글 재생 응용 프로그램의는 onActivityResult 메서드로 PendingIntent에 대한 응답을 보냅니다. TheonActivityResult 방법은 Activity.RESULT_OK (1) 또는 Activity.RESULT_CANCELED의 결과 코드를가집니다 (0). 응답 의도에 반환되는 주문 정보의 종류를 확인하려면, 인 - 앱 결제 참조를 참조하십시오. 

주문에 대한 구매 데이터는 예를 들어, 응답 의도에 INAPP_PURCHASE_DATA 키에 매핑 된 JSON 형식의 문자열입니다 :

'{ 
   "orderId":"12999763169054705758.1371079406387615",
   "packageName":"com.example.app",
   "productId":"exampleSku",
   "purchaseTime":1345678900000,
   "purchaseState":0,
   "developerPayload":"bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ",
   "purchaseToken":"rojeslcdyyiapnqcynkjyyjh"
 }'

앞의 예에서 계속, 당신은 응답 의도에서 응답 코드, 구매 데이터 및 서명을 얻을..

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   
if (requestCode == 1001) {          
     
int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
     
String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
     
String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
       
     
if (resultCode == RESULT_OK) {
         
try {
           
JSONObject jo = new JSONObject(purchaseData);
           
String sku = jo.getString("productId");
            alert
("You have bought the " + sku + ". Excellent choice,
               adventurer!"
);
         
}
         
catch (JSONException e) {
             alert
("Failed to parse purchase data.");
             e
.printStackTrace();
         
}
     
}
   
}
}

Security Recommendation: When you send a purchase request, create a String token that uniquely identifies this purchase request and include this token in the developerPayload.You can use a randomly generated string as the token. When you receive the purchase response from Google Play, make sure to check the returned data signature, the orderId, and the developerPayload String. For added security, you should perform the checking on your own secure server. Make sure to verify that the orderId is a unique value that you have not previously processed, and the developerPayload String matches the token that you sent previously with the purchase request.

Querying for Purchased Items

To retrieve information about purchases made by a user from your app, call the getPurchases method on the In-app Billing Version 3 service. Pass in to the method the In-app Billing API version (“3”), the package name of your calling app, and the purchase type (“inapp” or "subs").

Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);

The Google Play service returns only the purchases made by the user account that is currently logged in to the device. If the request is successful, the returned Bundle has a response code of 0. The response Bundle also contains a list of the product IDs, a list of the order details for each purchase, and the signatures for each purchase.

To improve performance, the In-app Billing service returns only up to 700 products that are owned by the user when getPurchase is first called. If the user owns a large number of products, Google Play includes a String token mapped to the key INAPP_CONTINUATION_TOKEN in the response Bundle to indicate that more products can be retrieved. Your application can then make a subsequent getPurchases call, and pass in this token as an argument. Google Play continues to return a continuation token in the response Bundle until all products that are owned by the user has been sent to your app.

For more information about the data returned by getPurchases, see In-app Billing Reference. The following example shows how you can retrieve this data from the response.

int response = ownedItems.getInt("RESPONSE_CODE");
if (response == 0) {
   
ArrayList<String> ownedSkus =
      ownedItems
.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
   
ArrayList<String>  purchaseDataList =
      ownedItems
.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
   
ArrayList<String>  signatureList =
      ownedItems
.getStringArrayList("INAPP_DATA_SIGNATURE");
   
String continuationToken =
      ownedItems
.getString("INAPP_CONTINUATION_TOKEN");
   
   
for (int i = 0; i < purchaseDataList.size(); ++i) {
     
String purchaseData = purchaseDataList.get(i);
     
String signature = signatureList.get(i);
     
String sku = ownedSkus.get(i);
 
     
// do something with this purchase information
     
// e.g. display the updated list of products owned by user
   
}

   
// if continuationToken != null, call getPurchases again
   
// and pass in the token to retrieve more items
}

Consuming a Purchase

You can use the In-app Billing Version 3 API to track the ownership of purchased in-app products in Google Play. Once an in-app product is purchased, it is considered to be "owned" and cannot be purchased from Google Play. You must send a consumption request for the in-app product before Google Play makes it available for purchase again.

Important: Managed in-app products are consumable, but subscriptions are not.

How you use the consumption mechanism in your app is up to you. Typically, you would implement consumption for in-app products with temporary benefits that users may want to purchase multiple times (for example, in-game currency or equipment). You would typically not want to implement consumption for in-app products that are purchased once and provide a permanent effect (for example, a premium upgrade).

To record a purchase consumption, send the consumePurchase method to the In-app Billing service and pass in the purchaseToken String value that identifies the purchase to be removed. The purchaseToken is part of the data returned in the INAPP_PURCHASE_DATA String by the Google Play service following a successful purchase request. In this example, you are recording the consumption of a product that is identified with the purchaseToken in thetoken variable.

int response = mService.consumePurchase(3, getPackageName(), token);

Warning: Do not call the consumePurchase method on the main thread. Calling this method triggers a network request which could block your main thread. Instead, create a separate thread and call the consumePurchasemethod from inside that thread.

It's your responsibility to control and track how the in-app product is provisioned to the user. For example, if the user purchased in-game currency, you should update the player's inventory with the amount of currency purchased.

Security Recommendation: You must send a consumption request before provisioning the benefit of the consumable in-app purchase to the user. Make sure that you have received a successful consumption response from Google Play before you provision the item.

Implementing Subscriptions

Launching a purchase flow for a subscription is similar to launching the purchase flow for a product, with the exception that the product type must be set to "subs". The purchase result is delivered to your Activity'sonActivityResult method, exactly as in the case of in-app products.

Bundle bundle = mService.getBuyIntent(3, "com.example.myapp",
   MY_SKU
, "subs", developerPayload);

PendingIntent pendingIntent = bundle.getParcelable(RESPONSE_BUY_INTENT);
if (bundle.getInt(RESPONSE_CODE) == BILLING_RESPONSE_RESULT_OK) {
   
// Start purchase flow (this brings up the Google Play UI).
   
// Result will be delivered through onActivityResult().
   startIntentSenderForResult
(pendingIntent, RC_BUY, new Intent(),
       
Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
}

To query for active subscriptions, use the getPurchases method, again with the product type parameter set to "subs".

Bundle activeSubs = mService.getPurchases(3, "com.example.myapp",
                   
"subs", continueToken);

The call returns a Bundle with all the active subscriptions owned by the user. Once a subscription expires without renewal, it will no longer appear in the returned Bundle.

Securing Your Application


To help ensure the integrity of the transaction information that is sent to your application, Google Play signs the JSON string that contains the response data for a purchase order. Google Play uses the private key that is associated with your application in the Developer Console to create this signature. The Developer Console generates an RSA key pair for each application.

Note:To find the public key portion of this key pair, open your application's details in the Developer Console, then click on Services & APIs, and look at the field titled Your License Key for This Application.

The Base64-encoded RSA public key generated by Google Play is in binary encoded, X.509 subjectPublicKeyInfo DER SEQUENCE format. It is the same public key that is used with Google Play licensing.

When your application receives this signed response you can use the public key portion of your RSA key pair to verify the signature. By performing signature verification you can detect responses that have been tampered with or that have been spoofed. You can perform this signature verification step in your application; however, if your application connects to a secure remote server then we recommend that you perform the signature verification on that server.

For more information about best practices for security and design, see Security and Design.


Trackback 0 And Comment 0

안드로이드 서버 php 통신(간단히)

|

안드로이드가 웹과 통신을 하기 위해선 아래 두가지가 필요하다.


1. 웹 서버 (php)

2. 인터넷 연결이 가능한 안드로이드 단말기 or 안드로이드 시뮬레이터


우리는 안드로이드 단말에서 정말 간단한 php 문을 호출할 생각이다.(나중에 응용가능하게)

웹 서버 같은경우에 apm 이나 wpn-xm 등을 설치해서 구축할수 있다.

설치방법은 구글신에게 물어보자.



php 코드 부분

먼저

값을 주고 받을 php 를 만든다.

아래는 아주 간단히 값을 받고 값을 전달하는 php문이다.


php 파일 이름은 phpTest.php 이다. 텍스트 편집기로 파일을 만들고 저장하자.

필자는 notpad++을 사용했다.


post 방식으로 각각 name, age, sex 라는 변수를 받아와

출력하는 간단한 php 입니다.



해당 php 파일을 자신의 서버에 올립시다.

아래 제가 생각하는 php에 대한 간단한 생각들.


php 통신

-보내주는건 많이 보내줄수있는듯 get 방식이든 post 방식이든 get방식같은경우에 글자수가 제한이 있고 주소창에서 입력이 가능하므로 결국엔 post 방식으로 보내주는게 안전할듯.

받을때는 echo 로 출력된 정보를 받는다고 생각하면 편할거같음. 받는 데이터 같은경우에 웹에있는 데이터를 받는다고 생각됨.

여러개의 데이터를 전송받기 위해서는 echo 에서 구분자를 이용한 방법이나 결국 json 형식으로 받는 수 밖에 없음(아님 xml)



결국 결론은 안드로이드 단말에서 php 서버에 보낼수 있는 변수들은 무제한이고, 받을수 있는 값들은 php 문에 출력되는 echo 문들 이다.

결국 이렇기 때문에 많은 데이터를 받을때는(mysql 사용등) json 형식같은 것을 사용해서 php 값들받게 되는것 같다.



안드로이드 코드부분

우리가 만들 안드로이드 코드는

버튼을 누르면 php 웹에 접속해서 원하는 값을 받는 코드입니다.

제일 먼저 해야될것은 AndroidMainfest에 인터넷이 가능하도록 퍼미션을 설정하는 것입니다.





그리고 active_main.xml 에서 버튼과 텍스트 뷰를 추가합니다.







허니콤이후로 네트워크 접속시 별도의 스레드를 돌려야 오류가 나지 않습니다.

AsyncTask를 사용합니다.







urlpath 에는 자기가 접속할 php 주소를 입력합니다.

onCreate 함수(엑티비티가 처음 시작할때 무조건 실행되는 함수)에서 

버튼과 텍스트뷰를 찾고 버튼을 클릭했을시에 HttpTask를 실행합니다.(AsyncTask)


  bn.setOnClickListener(new Button.OnClickListener(){
            public void onClick(View v) {

              new HttpTask().execute();               
            }           
        });




아래는 AsyncTask 입니다. 세번째 인자의 String를 입력했는데 이 값은 

doInBackground의 반환값이며, onPostExecute의 매개변수가 됩니다.

doInBackground의 반환값이 onPostExcute의 인자로 전달된다고 생각하면 될것 같습니다.

자세한 내용은 AsyncTask로 검색하면 나올것입니다.


php 상에서 post 값으로 받기 때문에 HttpPost 로 선언해주고

넘길 값들을 Vector 에 저장한후 웹으로 보내줍니다.




onPostExcute 에서 텍스트뷰를 변경해줍니다. onPostExcute는 doinBackground 가 실행된후 실행되는 함수이며,

안드로이드 메인 ui 같은경우에는 여기서 변경해주어야 에러가 나지 않습니다.








public class MainActivity extends Activity {

    Button bn;
    TextView result;
   
   
    //접속할주소
    private final String urlPath = "";
    private final String TAG = "PHPTEST";
   
    @Override
    protected void onCreate(Bundle savedInstanceState) {      
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       
        bn = (Button)findViewById(R.id.btn);
        result = (TextView)findViewById(R.id._result);
       
        bn.setOnClickListener(new Button.OnClickListener(){

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                new HttpTask().execute();   
            }
           
        });
           
    }
   
    class HttpTask extends AsyncTask<Void, Void, String>{

        @Override
        protected String doInBackground(Void... voids) {
            // TODO Auto-generated method stub
            try{
                HttpPost request = new HttpPost(urlPath);
                //전달할 인자들
                Vector<NameValuePair> nameValue = new Vector<NameValuePair>();
                nameValue.add(new BasicNameValuePair("name", "홍길동"));
                nameValue.add(new BasicNameValuePair("age", "24"));
                nameValue.add(new BasicNameValuePair("sex", "male"));               
               
                //웹 접속 - utf-8 방식으로
                HttpEntity enty = new UrlEncodedFormEntity(nameValue, HTTP.UTF_8);
                request.setEntity(enty);
               
                HttpClient client = new DefaultHttpClient();
                HttpResponse res = client.execute(request);
                //웹 서버에서 값받기
                HttpEntity entityResponse = res.getEntity();
                InputStream im = entityResponse.getContent();
                BufferedReader reader = new BufferedReader(new InputStreamReader(im, HTTP.UTF_8));
               
                String total = "";
                String tmp = "";
                //버퍼에있는거 전부 더해주기
                //readLine -> 파일내용을 줄 단위로 읽기
                while((tmp = reader.readLine())!= null)
                {
                    if(tmp != null)
                    {
                        total += tmp;
                    }
                }
                im.close();
                //결과창뿌려주기 - ui 변경시 에러
                //result.setText(total);
                return total;               
            }catch(UnsupportedEncodingException e){
                e.printStackTrace();
            }catch(IOException e){
                e.printStackTrace();
            }
            //오류시 null 반환
            return null;
        }
        //asyonTask 3번째 인자와 일치 매개변수값 -> doInBackground 리턴값이 전달됨
        //AsynoTask 는 preExcute - doInBackground - postExecute 순으로 자동으로 실행됩니다.
        //ui는 여기서 변경
        protected void onPostExecute(String value){
            super.onPostExecute(value);
            result.setText(value);
        }       
    }      
}



Trackback 0 And Comment 11
  1. 구독 2014.05.18 22:53 address edit & del reply

    그..HttpTask가 다른 클래스인데 urlPath가 어떻게 불러와진거죠???

    • Favicon of https://hyunity3d.tistory.com BlogIcon 히아레인 2014.05.19 08:11 신고 address edit & del

      HttpTask 는 MainActivity안에 내부 클래스로 설정하였습니다.

  2. 감사 2014.05.21 20:00 address edit & del reply

    다음과 같은 부분에 컴파일 에러나는데 어떻게 해야하나요?
    - 클릭 리스너 부분에 (view)-> 이부분
    - Vector<~>
    - super.onOptionsItemSelected(item);

  3. Favicon of https://taetanee.tistory.com BlogIcon 테타니 2014.08.16 03:25 신고 address edit & del reply

    똑같이 했는데 실행오류 '*****이(가) 중지되었습니다'가 나네요.
    죄송하지만 프로젝트를 보내주실 수 있는지요ㅠㅠ
    xpxksl@gmail.com
    염치불구하고 부탁드립니다!

    • Favicon of https://hyunity3d.tistory.com BlogIcon 히아레인 2014.08.19 09:49 신고 address edit & del

      최근에 확인해본결과 수정한거라 똑같이 하시면 실행오류 안뜹니다.
      해당 프로젝트 파일은 없습니다.

  4. 좋은글감사해요 2014.10.01 23:51 address edit & del reply

    올려주신 글로 실습중인데요
    버튼클릭시 아무 반응이 없더라구요
    해서 로그를 보니
    HttpHostConnectException: Connection to http://ip주소 .php refused

    ConnectException : http://ip주소.php : connect failed:EHOSTUNREACH
    이렇게 2개의 익셉션이 떠서 보니까
    컴퓨터상에서는 웹브라우져로 접근해서 echo부분확인이 되는데
    안드로이드에서 똑같이 http주소로 접근하니 없는페이지로 뜨더라구요
    웹페이지를 표시할 수 없습니다. 이 화면이요

    구글링으로 방화벽과 dmz? 부분을 해봤는데 여전하네요ㅠㅠ
    혹시 해결방법 아시나요? 라우터문제라고도 하는데.. 혹시 아는부분있으시면 답변 부탁좀 드립니다.
    2일째 붙잡고있네요ㅠㅠ

    • Favicon of https://hyunity3d.tistory.com BlogIcon 히아레인 2014.10.02 09:13 신고 address edit & del

      먼저 해당 주소로 안드로이드 기기에서 접속해 보세요.
      접속이 되나 확인해보시고 안되면 외부에서 접속이 불가능 한겁니다.
      <?php
      echo "test";
      ?>
      이런식으로 php 페이지를 만들어 들어가서 test라는 글자가 잘뜨나 확인하면 됩니다.

      외부에서 접속이 불가능하면 해당 컴퓨터환경에서 포트포워딩을 열어 80번 포트를 열어주거나 dmz를 열어주셔야됩니다.

  5. 잘모르겟어요 2014.11.22 15:38 address edit & del reply

    음 안드로이드와 php연동 연습중에있습니다. 이거 그대로 하면 버튼 누르면
    <!DOCTYPE HTML PUBLIC"-//IETF//DTD HTML 2.0//EN"><html><head><title>403Forbidden</title></head><body><h1>Forbidden</h1><p>You don't have permission to access/text.phpon(Win64)PHP/5.5.12 Server at 192.168.123.126 Port 80</address></body></html> 이렇게나오는데 무엇이 잘못된걸까요,,모르겠습니다.

  6. asd 2015.01.27 14:39 address edit & del reply

    이거 그대로 php파일만들어서 실행하는데
    바로 오류뜨고 강제종료되던데..되는소스맞아요 ??

  7. 잘봤습니다. 2015.01.28 11:07 address edit & del reply

    프로그램 실행하자마자 오류로 인해 종료되었꼬 logcat을 보니 이렇게 떳는데 이유가무었을까요 ?
    블로그 글과 똑같이 작성했습니다...ㅠㅠㅠ

    01-28 10:59:17.836: E/(10924): Device driver API match
    01-28 10:59:17.836: E/(10924): Device driver API version: 23
    01-28 10:59:17.836: E/(10924): User space API version: 23
    01-28 10:59:17.836: E/(10924): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Fri Nov 29 14:18:37 KST 2013
    01-28 10:59:17.901: D/OpenGLRenderer(10924): Enabling debug mode 0
    01-28 10:59:29.356: W/dalvikvm(10924): threadid=12: thread exiting with uncaught exception (group=0x42397700)
    01-28 10:59:29.356: E/AndroidRuntime(10924): FATAL EXCEPTION: AsyncTask #1
    01-28 10:59:29.356: E/AndroidRuntime(10924): java.lang.RuntimeException: An error occured while executing doInBackground()
    01-28 10:59:29.356: E/AndroidRuntime(10924): at android.os.AsyncTask$3.done(AsyncTask.java:299)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at java.lang.Thread.run(Thread.java:841)
    01-28 10:59:29.356: E/AndroidRuntime(10924): Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=susemi.pe.kr/test/index.php
    01-28 10:59:29.356: E/AndroidRuntime(10924): at org.apache.http.impl.client.DefaultRequestDirector.determineRoute(DefaultRequestDirector.java:591)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:293)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:670)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:509)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at com.example.dbtest3.MainActivity$HttpTask.doInBackground(MainActivity.java:73)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at com.example.dbtest3.MainActivity$HttpTask.doInBackground(MainActivity.java:1)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    01-28 10:59:29.356: E/AndroidRuntime(10924): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    01-28 10:59:29.356: E/AndroidRuntime(10924): ... 4 more
    01-28 10:59:31.646: I/Process(10924): Sending signal. PID: 10924 SIG: 9

유니티 xml 파일 로드

|









xml로 된 데이터 파일은 모두 string 형이므로 적절히 형변환을 해줘서 사용해야됨.

Trackback 0 And Comment 0
prev | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ··· | 13 | next