face Detect & media 굿자료

안드로이드 2012/01/20 01:47 Posted by <!--r'i"z&i\n+#]]x juree23
http://code.google.com/p/krvarma-android-samples/source/browse/#svn/trunk/DetectFace
저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

face Detect & media 굿자료  (0) 2012/01/20
cocos2d - 물리엔진1  (0) 2012/01/10
c2dm 메세지 안갈때 처리 및 한글문제 처리  (0) 2012/01/05
웹소켓 라이브러리  (0) 2011/12/30
coverflow  (0) 2011/12/29
udp 음성 전송  (0) 2011/12/29

cocos2d - 물리엔진1

안드로이드 2012/01/10 18:02 Posted by <!--r'i"z&i\n+#]]x juree23
http://www.raywenderlich.com/457/intro-to-box2d-with-cocos2d-tutorial-bouncing-balls
저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

face Detect & media 굿자료  (0) 2012/01/20
cocos2d - 물리엔진1  (0) 2012/01/10
c2dm 메세지 안갈때 처리 및 한글문제 처리  (0) 2012/01/05
웹소켓 라이브러리  (0) 2011/12/30
coverflow  (0) 2011/12/29
udp 음성 전송  (0) 2011/12/29

c2dm 메세지 안갈때 처리 및 한글문제 처리

안드로이드 2012/01/05 16:25 Posted by <!--r'i"z&i\n+#]]x juree23

어플 -> c2dm -> 어플

 

다음과같은경우 구글 검색으로 얻을수 있는 소스로 수행해보면

 

한글 수신이 문제 없다.

 

 

하지만

 

어플 -> 별도서버 -> c2dm -> 어플

 

다음과 같이 서버로 메시지를 전송하고,

 

서버에서 c2dm 으로 전송하는 방법에서 한글이 보내지지 않았다.

 

http://www.xhost.co.kr/bbs/?id=iphone,16

 

다음 링크에서 curl 을 이용하여 c2dm 으로 전송하는 소스를 이용할때

 

한글이 전송 안되는 현상 발견

 

파일 문자셋을 바꾸고 별별짓을 해도 안됨..

 

그러다가

 

$ch = curl_init();   
   
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/accounts/ClientLogin");   
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);   
   
$data = array('accountType' => 'HOSTED_OR_GOOGLE',   
'Email' => '아이디',   
'Passwd' => '비번',   
'source'=>'test-1.0',   
'service'=>'ac2dm');   
    
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);   
curl_setopt($ch, CURLOPT_POST, true);   
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);   
 
$result = curl_exec($ch); 
$auth = substr(strstr($result, "Auth="), 5);  
$auth = substr($auth, 0, strlen($auth)-1); 
 
curl_setopt($ch, CURLOPT_URL, "https://android.apis.google.com/c2dm/send"); 
 
$data = "registration_id=등록아이디"."&collapse_key=1"."&data.msg=메세지"; 
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 
 
$headers = array( 
    "Content-Type: application/x-www-form-urlencoded", 
    "Content-Length: ".strlen($data), 
    "Authorization: GoogleLogin auth=$auth" 
); 
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);  
 
$result = curl_exec($ch); 
echo $result."\n"; 
 
curl_close($ch); 

 

 

위의 메세지를 담는 부분을 인코딩하니 해결..

 

다음과 같이 바꿔준다.

 

$data = "registration_id=등록아이디"."&collapse_key=1"."&data.msg=".urlencode($메시지); 

 

 

저같이 고생하시는분들 없길 바라며...

 

원래 한글을 urlencode 하면 이상한 문자들이 나오는데,

 

c2dm 에서 재변환 하는 과정을 수행해 주나보다..

 

 

c2dm 전송 php 소스를 공개하신 로빈아빠님 감사드립니다.


원본이 아니었군요...;;

 

민상K 님 감사드립니다.


출처 : http://minsangk.com/blog/main/116


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


추가사항 


위으 소스로 push 를 빠르게 보내면 20개쯤 보내지고 잘 안보내지는 현상이 발생한다.


이유는 collapse_key=1


이것 때문인데


구글서버에서 이 키가 같은 값으로 계속오면


중복 메시지로 판단하고 연속으로 올 경우 무시해 버린단다.


이 키를 랜덤 숫자로 바꿔주면 매우 빠르게 보내도 처리해 준다.


srand((double)microtime()*1000000);

$collapse_key = rand(1,99);


$data = "registration_id=$phoneID"."&collapse_key=$collapse_key"."&data.msg=".urlencode($sendText);


이부분을 반드시 수정하여 사용하시길...

저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

face Detect & media 굿자료  (0) 2012/01/20
cocos2d - 물리엔진1  (0) 2012/01/10
c2dm 메세지 안갈때 처리 및 한글문제 처리  (0) 2012/01/05
웹소켓 라이브러리  (0) 2011/12/30
coverflow  (0) 2011/12/29
udp 음성 전송  (0) 2011/12/29

웹소켓 라이브러리

안드로이드 2011/12/30 10:42 Posted by <!--r'i"z&i\n+#]]x juree23
http://code.google.com/p/unitt/w/list
저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

cocos2d - 물리엔진1  (0) 2012/01/10
c2dm 메세지 안갈때 처리 및 한글문제 처리  (0) 2012/01/05
웹소켓 라이브러리  (0) 2011/12/30
coverflow  (0) 2011/12/29
udp 음성 전송  (0) 2011/12/29
안드로이드 차트 라이브러리  (0) 2011/12/28

coverflow

안드로이드 2011/12/29 03:39 Posted by <!--r'i"z&i\n+#]]x juree23
http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html
저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

c2dm 메세지 안갈때 처리 및 한글문제 처리  (0) 2012/01/05
웹소켓 라이브러리  (0) 2011/12/30
coverflow  (0) 2011/12/29
udp 음성 전송  (0) 2011/12/29
안드로이드 차트 라이브러리  (0) 2011/12/28
안드로이드 스트리밍 동영상 서버 적용  (0) 2011/12/27

udp 음성 전송

안드로이드 2011/12/29 02:22 Posted by <!--r'i"z&i\n+#]]x juree23
http://code.google.com/p/rxwen-blog-stuff/source/browse/trunk/android/streaming_audio/src/rmd/media/StreamingAudio/UdpStream.java
저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

웹소켓 라이브러리  (0) 2011/12/30
coverflow  (0) 2011/12/29
udp 음성 전송  (0) 2011/12/29
안드로이드 차트 라이브러리  (0) 2011/12/28
안드로이드 스트리밍 동영상 서버 적용  (0) 2011/12/27
m4a저장하기  (0) 2011/12/26

안드로이드 차트 라이브러리

안드로이드 2011/12/28 13:20 Posted by <!--r'i"z&i\n+#]]x juree23
http://www.achartengine.org/content/download.html
저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

coverflow  (0) 2011/12/29
udp 음성 전송  (0) 2011/12/29
안드로이드 차트 라이브러리  (0) 2011/12/28
안드로이드 스트리밍 동영상 서버 적용  (0) 2011/12/27
m4a저장하기  (0) 2011/12/26
로컬에 이미지파일 저장하기  (0) 2011/12/26

안드로이드 스트리밍 동영상 서버 적용

안드로이드 2011/12/27 02:14 Posted by <!--r'i"z&i\n+#]]x juree23
http://justdevelopment.blogspot.com/2009/10/video-streaming-with-android-phone.html#Setting_up_a_Streaming_Media_Server
저작자 표시 비영리 변경 금지

'안드로이드' 카테고리의 다른 글

udp 음성 전송  (0) 2011/12/29
안드로이드 차트 라이브러리  (0) 2011/12/28
안드로이드 스트리밍 동영상 서버 적용  (0) 2011/12/27
m4a저장하기  (0) 2011/12/26
로컬에 이미지파일 저장하기  (0) 2011/12/26
C2DM  (0) 2011/12/26

m4a저장하기

안드로이드 2011/12/26 18:44 Posted by <!--r'i"z&i\n+#]]x juree23
public void startRecording() throws IOException {

    recorder
= new MediaRecorder();

    path
= "/sdcard/pithysongs_" + System.currentTimeMillis() + ".m4a";

   
String state = android.os.Environment.getExternalStorageState();

   
if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
       
throw new IOException("SD Card is not mounted.  It is " + state
               
+ ".");
   
}

    recorder
.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder
.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder
.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder
.setOutputFile(path);
    recorder
.prepare();
    recorder
.start();
   
}

http://stackoverflow.com/questions/7357826/how-can-i-record-audio-file-as-m4a-format 
저작자 표시 비영리 변경 금지

로컬에 이미지파일 저장하기

안드로이드 2011/12/26 18:42 Posted by <!--r'i"z&i\n+#]]x juree23
http://stackoverflow.com/questions/5469954/android-image-save-to-res-drawable-folder
저작자 표시 비영리 변경 금지

C2DM

안드로이드 2011/12/26 18:34 Posted by <!--r'i"z&i\n+#]]x juree23
http://susemi99.tistory.com/683
저작자 표시 비영리 변경 금지

http://susemi99.tistory.com/571

저작자 표시 비영리 변경 금지

[android] title bar에 그라데이션 배경색 넣기

안드로이드 2011/12/26 18:25 Posted by <!--r'i"z&i\n+#]]x juree23
http://susemi99.tistory.com/955
저작자 표시 비영리 변경 금지

에니메이션효과

안드로이드 2011/12/26 18:23 Posted by <!--r'i"z&i\n+#]]x juree23
http://susemi99.tistory.com/1056
http://blog.daum.net/hopefullife/98 
저작자 표시 비영리 변경 금지

안드로이드 스트리밍 플레이

안드로이드 2011/12/26 14:52 Posted by <!--r'i"z&i\n+#]]x juree23
http://blog.pocketjourney.com/2008/04/04/tutorial-custom-media-streaming-for-androids-mediaplayer/
http://blog.daum.net/satomail/99 
저작자 표시 비영리 변경 금지

android listview에서 클릭안될때

안드로이드 2011/12/26 14:32 Posted by <!--r'i"z&i\n+#]]x juree23
http://devbible.tistory.com/9
http://www.androes.com/59 
저작자 표시 비영리 변경 금지

intent에 object넘겨서 사용하는법

안드로이드 2010/08/20 10:17 Posted by <!--r'i"z&i\n+#]]x juree23

Bundle extras = new Bundle(); 
extras
.putSerializable("blabla", ObjectB); 
intent
.putExtras(extras); 
 
... 
 
Object y = getIntent().getExtras().get("blabla"); 
저작자 표시 비영리 변경 금지
http://efreedom.com/Question/1-2865452/Is-it-possible-to-display-inline-images-from-html-in-an-Android-TextView

private
class ImageGetter implements Html.ImageGetter { 
 
   
public Drawable getDrawable(String source) { 
       
int id; 
 
       
if (source.equals("stack.jpg")) { 
            id
= R.drawable.stack; 
       
} 
       
else if (source.equals("overflow.jpg")) { 
            id
= R.drawable.overflow; 
       
} 
       
else { 
           
return null; 
       
} 
 
       
Drawable d = getResources().getDrawable(id); 
        d
.setBounds(0,0,d.getIntrinsicWidth(),d.getIntrinsicHeight()); 
       
return d; 
   
} 
}; 
저작자 표시 비영리 변경 금지

Gallery, Camera 사용

안드로이드 2010/07/23 17:15 Posted by <!--r'i"z&i\n+#]]x juree23
안드로이드에는 기본적으로 Gallery와 Camera app.이 설치되어 있습니다.  물론 디바이스 제조업체에서 그 필요에 따라 기본적인 기능의 Camera app.보다 좀 더 다양한 기능을 하는 (하드웨어적으로 더 다양하고 좋은 기능을 장착했을 경우에도..) Camera app.을 개발하여 사전에 장착했을 수 도 있습니다.

개인적으로는 좀 더 나은 기능의 Camera app.을 설치 했을 경우라도 안드로이드 플랫폼에서 제공하는 기본적인 기능의 Camera app.은 지원해야 하지 않나 합니다.  현재 안드로이드 디바이스가 얼마 되지 않아 지원 하는지 안 하는지는 잘 모르겠습니다.  그 이유는 새로운 기능의 Camera app.은 물론 다른 패키지, 클래스 이름을 사용할 것이기 때문에 Camera app.과 연계하는 app.에서 Camera 기능을 사용하는 데 있어 제약이 있기 때문입니다.  그러므로 기본적인 Camera app.이 지속적으로 지원 된다면 연동하는 데 있어 별 문제가 없겠죠.

다음 코드는 어떤 app.이 Gallery에 있는 이미지 리스트를 확인하고 불러오는 부분 입니다.  MIME 타입 정의에 따라 원하는 리스트를 정의할 수 있습니다.  여기에서 당연 눈에 띄는 부분은 Intent.ACTION_GET_CONTENT 입니다.  처음에 이 코드를 보았을때 과연 이 Action이 어떤 Activity를 불러올까 였는데 기본 안드로이드 플랫폼에서는 Gallery의 리스트를 호출하더군요.  안드로이드 디바이스 제조업체에서도 이 Action을 적절한 Activity와 연결해 주었길 기대해 봅니다. 

                Intent intent = new Intent();  
                intent.setAction(Intent.ACTION_GET_CONTENT);  
        intent.setType("image/*");  
       startActivityForResult(intent ,REQ_IMAGE_SELECT);

콘텐츠를 선택하면 아래 부분이 불려지게 됩니다.  성공여부와 Activity를 불렀을 때 보냈던 코드와 더불어 Intent가 오게 됩니다.  이 Intent에 data에 대한 정보가 들어 있습니다.  여기서는 선택한 콘텐츠의 Uri 정보를 리턴합니다.

onActivityResult(int requestCode, int resultCode, Intent data)

Uri curImgURI = data.getData();

이제 받은 콘텐츠 Uri를 가지고 적절히 사용하면 됩니다.

단순히 저장된 컨텐츠를 가져오는 것이 아니라 Camera Activity를 호출하여 바로 찍은 콘텐츠를 가져오고자 할때는 어떻게 할까요.  아래와 같습니다.  물론 Camera Activity를 직접 호출할 수도 있습니다.  패키지와 클래스를 다음과 같이 ("com.android.camera", "com.android.camera.Camera") 설정해서 startActivity를 날리면 됩니다.  
문제는 이렇게 해서 콜을 하면 안드로이드 플랫폼 상의 기본 Camera app.이 실행이 됩니다.  안드로이드 디바이스 제조업체에서 기본 카메라 기능이 떨어져서 빼버리고 나름대로의 Camera app.을 만들어 넣어 놓았다면 과연 실행될까 하는 의문입니다.  안된다고 봅니다.  그래서 아래와 같은 MediaStore.ACTION_IMAGE_CAPTURE 를 써보았습니다.  일단 기본 안드로이드 플랫폼에서는 기본 Camera를 띄우지만 (그것밖에 없기 때문에 그렇다고 생각됩니다) 다른 Camera app.이 있다면 자체적으로 연계해서 동작시키지 않을까 하는 기대를 해 봅니다.  

Intent intent = new Intent();
intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, REQ_CAMERA_SELECT);

결과는 좀 다르게 받게 됩니다.  결과 값을 bitmap으로 보내 줍니다.  나머지는 위와 동일합니다.

                Bitmap bm = (Bitmap) data.getExtras().get("data");
저작자 표시 비영리 변경 금지

Get File Path of Gallery Image

안드로이드 2010/07/23 16:56 Posted by <!--r'i"z&i\n+#]]x juree23

Get File Path of Gallery Image

  1. // To open up a gallery browser  
  2. Intent intent = new Intent();  
  3. intent.setType("image/*");  
  4. intent.setAction(Intent.ACTION_GET_CONTENT);  
  5. startActivityForResult(Intent.createChooser(intent, "Select Picture"),1);  
  6.   
  7. // To handle when an image is selected from the browser, add the following to your Activity  
  8. @Override  
  9. public void onActivityResult(int requestCode, int resultCode, Intent data) {   
  10.   
  11.     if (resultCode == RESULT_OK) {  
  12.   
  13.         if (requestCode == 1) {  
  14.   
  15.             // currImageURI is the global variable I'm using to hold the content:// URI of the image  
  16.             currImageURI = data.getData();  
  17.         }  
  18.     }  
  19. }  
  20.   
  21. // And to convert the image URI to the direct file system path of the image file  
  22. public String getRealPathFromURI(Uri contentUri) {  
  23.   
  24.     // can post image  
  25.     String [] proj={MediaStore.Images.Media.DATA};  
  26.     Cursor cursor = managedQuery( contentUri,  
  27.             proj, // Which columns to return  
  28.             null,       // WHERE clause; which rows to return (all rows)  
  29.             null,       // WHERE clause selection arguments (none)  
  30.             null); // Order-by clause (ascending by name)  
  31.     int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);  
  32.     cursor.moveToFirst();  
  33.   
  34.     return cursor.getString(column_index); 
저작자 표시 비영리 변경 금지

Android 에서 Intent 를 이용한 어플리케이션 간 통신

안드로이드 2010/07/23 16:12 Posted by <!--r'i"z&i\n+#]]x juree23
http://alnova2.tistory.com/365?srchid=BR1http%3A%2F%2Falnova2.tistory.com%2F365
저작자 표시 비영리 변경 금지