1

我正在尝试修改 android lvl 库,作为其中的一部分,我将代码作为我的项目源(diff 包)的一部分包含在内,而不是将其用作库。但是这段代码失败了

boolean bindResult = mContext.bindService(
    new Intent(ILicensingService.class.getName()),
    this,  // ServiceConnection.
    Context.BIND_AUTO_CREATE);

if (bindResult) {
  mPendingChecks.offer(validator);
} else {
  Log.e(TAG, "Could not bind to service.");
  validator.getCallback().stop("Could not bind to service.");   
}

它在说:

Unable to start service Intent { act=com.myApp.com.android.vending.licensing.ILicensingService }: not found

这是为什么?我该如何解决?它作为库工作,但是当代码合并时它没有

感谢帮助

4

1 回答 1

2

你创造Intent我认为不正确。尝试用这个替换你的:

new Intent(YourActivity.this, ILicensingService.class) //YourActivity is activity from its you want to start service.

注意:不要忘记添加ServiceManifest.xml

于 2012-06-19T23:01:28.313 回答