2013-07-15 2 views
0

백그라운드에서 실행되는 안드로이드 앱을 만들고 놀랄만한 또는 새로운 마사지가 있는지 확인하고 그것이 사실이라면 무언가를하십시오. 백그라운드에서 앱을 실행하려면 어떻게해야합니까? (뒤로 버튼을 클릭하면 닫히지 않습니다) miscall 및 new message 상태에 액세스하는 방법 나는 안드로이드에서 아마추어입니다.안드로이드에서 miscall 및 새 메시지 상태에 액세스하는 방법?

감사합니다.

답변

0

보이지 않는 SMS 메시지의 경우 content : // sms에 메시지가 있는지 확인하기 위해 확인할 수있는 열이 있습니다. 열 이름이 "표시됨"입니다.

IT 및 검사를 호출

예 :

ContentResolver mContectResolver = context.getContentResolver(); 
     Uri uri = Uri.parse("content://sms/"); 
     String[] mProjection = { 
       "_id", 
       "address", 
       "person", 
       "date", 
       "body", 
       "protocol", 
       "seen" 
     }; 

     Cursor cursor = mContectResolver.query(uri, mProjection, null, null, null); 
     cursor.moveToFirst(); 
     for(int i = 0 ; i<cursor.getCount() ; i++){ 

       if(cursor.getString(cursor.getColumnIndexOrThrow("seen")).equalsIgnoreCase("1")){ 
//Message has not been seen 
} 
      cursor.moveToNext(); 
     } 

     cursor.close(); 
+0

I 라인 1의 상황으로 무슨 정의해야합니까? – mohammad

+0

컨텍스트 context = getApplicationContext(); 이 메서드를 호출하는 것은 Activity에서 얻은 컨텍스트입니다. –

관련 문제