为什么在我的IntentService中没有调用onHandleIntent

时间:2018-01-13 21:45:53

标签: android android-service android-service-binding

这是我的服务类

public class ContactSync extends IntentService {
    private static final String TAG = "com.ric.connectme.Services.ContactSync";


    public ContactSync() {
        super(TAG);
    }

    public ContactSync(String name) {
        super(name);
    }



    @Override
    protected void onHandleIntent(@Nullable Intent intent) {
        if (intent != null) {
            Toast t = Toast.makeText(getBaseContext(), message, Toast.LENGTH_LONG);
            t.setGravity(Gravity.CENTER, 0, 0);
            t.show();
            GoForUplodeContect(intent);
        }
    }


    private void GoForUplodeContect(Intent intent){
        RsXtraUserNumbersBackupUploder.Uplode(getBaseContext(),intent);
    }


    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}

这是我在AndroidManifest中插入的内容

<service android:name=".Services.ContactSync">

        </service>

这就是我调用此服务的方式

Intent intent = new Intent(context,ContactSync.class);
        intent.putExtra(RsXtraIntetBundelKeys.USER_ID,userId);
        context.startService(intent);

我尝试了一切,系统启动服务但 onHandleIntent 没有执行。

任何人都可以帮我吗?

0 个答案:

没有答案