안드로이드의 연락처 검색이 불편하여 2010년부터 연락처 검색 (SmartSearch) 앱을 만들어 배포하고 있습니다.

최근 Android가 버전업이 되고 새로 안드로이드 폰이 나오면서 연락처 검색 (SmartSearch) 앱의 기능 중 "연락처 보기" 화면이 제대로 표시되지 않는 스마트폰이 생기고 있습니다. 그래서 "연락처 보기"에서 연락처를 보여 주는 방식을 변경 하였습니다.

기존 방식
//--- RAW_CONTACT_ID로 연락처 조회 (예전 방법)
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://contacts/people/" + String.valueOf(contact.getId())));
startActivity(intent);


새로 변경한 방식

//--- CONTACT_ID로 연락처 조회

intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, contact.getContactId()));
startActivity(intent);


연락처 검색을 위해서 ContactsContract.Data를 사용 했었는데
여기서 직접 ContactsContract.Contacts의 CONTACT_ID를 구할 수 있는
방법이 없어서 RAW_CONTACT_ID를 사용 했었습니다.

그런데 최근에 정상 동작하지 않는 스마트폰이 있어서
해결 방법을 찾다 보니 Android가 업그레이드 되어 쉽게 CONTACT_ID를
구할 수 있어서 CONTACT_ID로 연락처를 조회하도록 변경 하였습니다.
 
오픈소스 비즈니스 컨설팅

Posted by 산사랑

2011/04/24 01:07 2011/04/24 01:07
, , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/328

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/328

Leave a comment
[로그인][오픈아이디란?]

앱비스니스 기획과정

AppCenter에서 앱 개발자를 위한 실무 과정과 창업 과정의 교육 과정을 개설 했습니다. 2011년 4월 11일 월요일부터 2011년 4월 22일까지 진행되는 교육 과정은 각 과정별로 5만원의 교육비를 받고 있지만 90%가 할인된 금액이라고 합니다.




Posted by 산사랑

2011/04/05 19:58 2011/04/05 19:58
, , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/325

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/325

Leave a comment
[로그인][오픈아이디란?]

브라우저별 HTML5 지원 점수 변천사

브라우저별로 HTML5 지원 점수를 살펴 보았습니다.

일반 웹 환경에서는 IE를 제외하고는 대부분이 300점 만점에 250점 이상이고
모바일 환경에서는 300점 만점에 170점 이상 이군요.

HTML5 지원 점수 현황

*** 참고 문헌 ***

Posted by 산사랑

2011/03/30 12:26 2011/03/30 12:26
, , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/320

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/320

Leave a comment
[로그인][오픈아이디란?]
Android에서 JSON 데이터를 송수신하기 위해서 HttpURLConnection을 사용하여 만든 함수 입니다.

  • serverURL : JSON 요청을 받는 서버의 URL
  • postPara : POST 방식으로 전달될 입력 데이터
  • flagEncoding : postPara 데이터의 URLEncoding 적용 여부
  • 반환 데이터 : 서버에서 전달된 JSON 데이터

    public static String getJson(String serverUrl, String postPara, boolean flagEncoding) throws Exception {
        URL url = null;
        HttpURLConnection conn = null;
        PrintWriter postReq = null;
        BufferedReader postRes = null;
        StringBuilder json = null;
        String line = null;
        
        json = new StringBuilder();
        try {
            if (flagEncoding) {
                postPara = URLEncoder.encode(postPara);
            }
            
            url = new URL(serverUrl);
            conn = (HttpURLConnection) url.openConnection();
            conn.setDoOutput(true);
            conn.setUseCaches(false);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "text/plain");
            conn.setRequestProperty("Content-Length",
                                                       Integer.toString(postPara.length()));
            conn.setDoInput(true);
            
            postReq = new PrintWriter(
                              new OutputStreamWriter(conn.getOutputStream(), "UTF-8"));
            postReq.write(postPara);
            postReq.flush();
            
            postRes = new BufferedReader(
                             new InputStreamReader(conn.getInputStream(), "UTF-8"));
            while ((line = postRes.readLine()) != null){
                json.append(line);
            }
            conn.disconnect();
        } catch (MalformedURLException ex) {
            throw new Exception(ex.getMessage());
        } catch (IOException ex) {
            throw new Exception(ex.getMessage());
       } catch (Exception ex) {
            throw new Exception(ex.getMessage());
       }
        return json.toString();    
    }


Posted by 산사랑

2011/03/08 00:40 2011/03/08 00:40
, , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/304

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/304

Leave a comment
[로그인][오픈아이디란?]

안드로이드 앱을 통한 apk 설치 방법

안드로이드 앱에 apk 파일을 내장하여, apk 파일을 설치하는 샘플 입니다.

* 설치할 앱의 저장 위치 : /res/raw/testapp.apk
intent = new Intent(Intent.ACTION_VIEW);
apkFile = rawToFile(
                  getResources().openRawResource(R.raw.daoubus), "testapp.apk");
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
startActivity(intent);

* Raw Resource에 저장된 파일을 InputStream이 아닌 파일로 받는 함
  - /res/raw/에 있는 파일을 /sdcard/zztemp/ 폴더 아래에 복사한 후 해당 파일을 반환 한다.
  - /res/raw/에 있는 파일을 직접 반환할 수 있는 방법이 없기 때문에 이러한 방법을 사용 한다.
  - 권한 설정 : <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  - 호출 방법 : rawToFile(getResources().openRawResource(R.raw.raw명, "testapp.apk");
   public static File rawToFile(InputStream finp, String filename) {
	FileOutputStream fout = null;
   	File tmpFile = null;
	byte[] buf = null;
	int cntRead = 0;

   	tmpFile = new File(
           Environment.getExternalStorageDirectory() + "/zztemp");
   	if (!tmpFile.exists()) {
   		tmpFile.mkdir();
   	}

		buf = new byte[1024 + 1];
		try {
			fout = new FileOutputStream(
                            new File(tmpFile + "/" + filename));
			while (0 < (cntRead = finp.read(buf))) {
				fout.write(buf, 0, cntRead);
			}
		} catch (FileNotFoundException e1) {
			return null;
		} catch (IOException e) {
			return null;
		} finally {
			try {
				if (fout != null) {
					fout.close();
				}
			} catch (Exception e) {
				fout = null;
			}
			try {
				if (finp != null) {
					finp.close();
				}
			} catch (Exception e) {
				finp = null;
			}
		}
   	return new File(tmpFile + "/" + filename);
   }


*** 참고 문헌 ***

Posted by 산사랑

2011/01/06 20:29 2011/01/06 20:29
, , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/296

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/296

Leave a comment
[로그인][오픈아이디란?]

무료 안드로이드 앱: QR 명함

저는 2010년 7월(?)부터 갤럭시S를 쓰기 시작 했습니다. 갤럭시S가 안드로이드 기반이고 안드로이드는 Java로 이루어져 있기 때문에, 스마트폰을 사용하면서 내게 필요하지만 없는 것을 몇개 만들어 쓰고 있습니다.

SmartQRCode (QR 명함)도 그중에 하나로 스마트폰에서 QRCode로 명함을 만들어 표시해 줍니다. 스캐니 등의 QRCode Reader를 사용하여 손쉽게 명함 정보를 교환할 수 있습니다.

현재 안드로이드 마켓에 "QR 명함", "QR Card"라는 이름으로 무료로 등록되어 있습니다.
사용자 삽입 이미지

필요에 의해서 아주 간단히 만들었지만
주요 기능을 말씀드리면 다음과 같습니다.
  • 분류 지원 : Company, Community, Other (3종류의 명함을 지원)
  • 다양한 QRCode 종류 지원
    명함, 전화번호, 이메일, 사이트, 메모, Android Market
  • 다양한 QRCode 크기 지원
첫 화면에서 자신이 설정한 QRCode를 화면에 표시 합니다.
여기서 "분류"를 사용하여 명함의 종류를 변경하거나 QRCode의 종류와 크기를 변경할 수 있습니다. 단, 여기서 변경된 값은 저장되지 않습니다.

설정에서 3가지 명함에 들어갈 데이터를 저장할 수 있습니다. 최종 저장된 명함이 항상 첫화면에 표시되므로 첫 화면에 표시할 명함을 선택한 후, 마지막으로 저장 하세요.

설정된 값은 SharedPreferences를 사용하여 저장을 했더니, 좀 느려서 설정을 저장할 때 시간이 걸립니다. (좋은 방안이 있으면 알려 주세요.)

사용자 삽입 이미지
"브라우저로" 메뉴는 Google Apps Engine으로 만든 QRCode 생성 웹 화면을 연동해 두었습니다. "QR 명함"은 QRCode 생성 웹을 Android로 옮긴 것 입니다.

사용자 삽입 이미지

*** 참고 문헌 ***

Posted by 산사랑

2010/12/17 13:20 2010/12/17 13:20
, , , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/291

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/291

Leave a comment
[로그인][오픈아이디란?]

Android: AlertDialog 중 SingleChoice 사용법

Single choice list
  • public class AlertDialog extends Dialog
  • /res/values/~.xml
  • Dialog에서 보여줄 선택 목록을 정의 한다.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
    <string-array name="smartqrcode_language_array">
        <item>UTF-8</item>
        <item>Shift_JIS</item>
        <item>ISO-8859-1</item>
    </string-array>
</resources>
  • Activity
private static final int DIALOG_SINGLE_CHOICE_CATEGORY = 0;

//--- Dialog를 화면에 표시 한다.
showDialog(DIALOG_SINGLE_CHOICE_CATEGORY); //--- Dialog 표시

//--- 화면에 표시할 Dialog를 작성 한다.
protected Dialog onCreateDialog(int id) {
    AlertDialog.Builder builder = null;
    AlertDialog alert = null;

    switch (id) {
    case DIALOG_SINGLE_CHOICE_CATEGORY:
        builder = new AlertDialog.Builder(this);
        //--- 아이콘 지정
        builder.setIcon(R.drawable.smartqrcode_icon);            
        //--- 제목 지정
        builder.setTitle(R.string.smartqrcode_category);
        builder.setSingleChoiceItems(
            //--- 선택 목록 지정
            R.array.smartqrcode_category_array,       
            0,      //--- 초기 선택 값 지정 (0, 1, 2, ...)
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, 
                                   int item) { 
                    //--- item. 선택된 값의 index
                    String[] items = null;
                    String strItem = null;

                    items = getResources().getStringArray(
                        R.array.smartqrcode_category_array);
                    strItem = items[item];  //--- 선택된 항목
                    dialog.dismiss(); //--- Dialog 닫기
                }
            }
        );
        alert = builder.create();
        break;
    }
    return alert;
}

*** 참고 문헌 ***

Posted by 산사랑

2010/12/17 12:49 2010/12/17 12:49
, , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/290

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/290

Leave a comment
[로그인][오픈아이디란?]

Android: Spinner 사용법

샘플을 통해 HTML에서 select (선택 목록)에 해당하는 Spinner의 사용법을 소개 합니다.

Spinner

Spinner는 여러개의 목록에서 값을 선택하고자 할 때 사용하는 View 이다. HTML에서 보면 select 태그와 동일한 기능을 한다.

  • /res/layout/~.xml
<Spinner
    android:id="@+id/max_contacts" 
    android:layout_width="200dip" 
    android:layout_height="wrap_content"
    //--- 선택 목록 화면에 표시할 제목
    android:prompt="@string/smartsearch_max_contacts"   
    style="@android:style/Widget.Spinner"
    >
</Spinner>
  • /res/values/~.xml
  • 선택 목록을 배열로 관리하면 편리 하다.
  • getResources().getStringArray(
    R.array.smartsearch_max_contacts_array)로 문자열 배열을 가져올 수 있다.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
	<string-array name="smartsearch_max_contacts_array">
 	    <item>10</item>
	    <item>20</item> 
	    <item>30</item>
	    <item>40</item>
	    <item>50</item>
	    <item>100</item>
	    <item>200</item>
	    <item>500</item> 
	    <item>1000</item>
	</string-array>
</resources>
  • Activity
  • implements android.widget.AdapterView$OnItemSelectedListener 를 구현 하여야 한다.
private int maxContacts = 100;
private int maxContactsPos = 5;
private Spinner vMaxContacts = null;
ArrayAdapter<CharSequence> maxContactsAdapter= null;

vMaxContacts = (Spinner)findViewById(R.id.max_contacts);
maxContactsAdapter = ArrayAdapter.createFromResource(this, 
    R.array.smartsearch_max_contacts_array, 
    android.R.layout.simple_spinner_item);
maxContactsAdapter.setDropDownViewResource(
    android.R.layout.simple_spinner_dropdown_item);
vMaxContacts.setAdapter(maxContactsAdapter);
vMaxContacts.setOnItemSelectedListener(this);
//--- 선택값을 지정할 때마다 onItemSelected 함수가 호출
vMaxContacts.setSelection(maxContactsPos);      

//--- parent. 상위 View, view. 선택된 뷰
//--- position. Adapter에서 view의 위치
//-- id. 선택된 항목의 row id
public void onItemSelected(AdapterView<?> parent, View view, 
                           int position, long id) {
    if (parent == vMaxContacts) {
        maxContactsPos = position;
        maxContacts = Integer.parseInt(
            parent.getItemAtPosition(position).toString());
    }
}

public void onNothingSelected(AdapterView<?> parent) {
}

*** 참고 문헌 ***

Posted by 산사랑

2010/12/17 12:40 2010/12/17 12:40
, , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/289

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/289

Leave a comment
[로그인][오픈아이디란?]
공개SW 역량프라자에서 2010년 12월 정기 기술 세미나를 2010년 12월 22일에 진행을 합니다. 이번에는 모바일과 관련된 주제로 세미나를 하네요.

Posted by 산사랑

2010/12/15 10:37 2010/12/15 10:37

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/286

Trackbacks List

  1. portable vaporizer

    Tracked from portable vaporizer 2013/05/13 17:32 Delete

    오픈소스 비즈니스 컨설팅 :: 세미나: 공개SW 역량프라자 정기 기술세미나, 2012.12.22

Leave a comment
[로그인][오픈아이디란?]

Android 2.2 WebView의 HTML5 지원 점수

하이브리드 앱을 좋아하는데, 안드로이드의 WebView에서 HTML5가 어느정도 지원하는지 확인해 보았다. 테스트 점수는 176점으로 아직은 조금 낮은 편이다.

*** 참고 문헌 ***

Posted by 산사랑

2010/12/02 14:26 2010/12/02 14:26
, , , , ,
Response
No Trackback , No Comment
RSS :
http://www.jopenbusiness.com/tc/oss/rss/response/283

Trackback URL : http://www.jopenbusiness.com/tc/oss/trackback/283

Leave a comment
[로그인][오픈아이디란?]

블로그 이미지

개인적인 글쓰기와 오픈소스 비즈니스 컨설팅 관련 글을 정리합니다. consult (골뱅이) jopenbusiness.com

- 산사랑

Archives

12명이 RSS를 구독하고 있습니다.

Site Stats

Total hits:
517752
Today:
141
Yesterday:
337

*** 방문자 통계 ***
0516 : (182)
0517 : (177)
0518 : (194)
0519 : (179)
0520 : (220)
0521 : (275)
0522 : (337)
0523 : (141)
7일간 총 방문자수 : 1564