2012-10-22 3 views
2

응용 프로그램 활동을 방해하거나 방해하지 않고 백그라운드 스레드에서 서버의 데이터를 lapping하기 위해 내 응용 프로그램 용 IntentService를 사용하려고합니다. 여기에 내가이 일을 does'tIntentService가 호출되지 않았습니다.

public class ChannelsActivity extends Activity { 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      Intent intent = new Intent(this , SearchService.class); 
      startService(intent); 
     } 
나는 또한 매니페스트 파일에서 서비스 속성을 정의

하지만 내 응용 프로그램의 주요 활동이 서비스를 시작 내 간단한 IntentService

public class SearchService extends IntentService { 

    public SearchService() { 
    super("SearchService"); 
    } 

    @Override 
    protected void onHandleIntent(Intent intent) { 
    Log.d("Tag","service started"); 
    } 

}

입니다 나를 위해 나는 무엇이 문제인지 모른다.

<application 
    <activity 
     android:name=".ChannelsActivity" 
     android:screenOrientation="landscape" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <service android:name=".SearchService"/> 

</application> 

나는 stu이다. 이 문제가 있으면 도움이 될 것입니다.

+0

항상 .logost를 게시하십시오. –

+0

@Bhanu Kaushik 님, 빠른 답장을 보내 주셔서 감사합니다. logcat 창에서 아무런 오류나 경고가 없습니다. –

+0

디버거와 함께 실행하고 서비스를 시작하려고 시도 할 때 로그되지 않은 예외가 발생하는지 확인하십시오. – Ralgha

답변

0

게시 한 코드가 작동해야합니다. logcat 창에서 디버그 로그 "service started"가 표시됩니까? 어리석은 소리 일지라도 SearchService는 실행될 것이며 광범위한 작업이 없기 때문에 Search Service가 실행되고 즉시 종료됩니다. 실행중인 서비스에서 서비스를 보지 못해서 목표를 달성 할 수 없습니다.

희망이 있습니다.

+0

패키지 이름이 소문자 여야하기 때문에 ... – Nabin

관련 문제