我有一个bindService的问题。在我的活动中,我有以下代码:Android绑定服务问题
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className,
IBinder service) {
mService = IPrimary.Stub.asInterface(service);
}
public void onServiceDisconnected(ComponentName className) {
mService = null;
}
};
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.login);
mApi = new ApiRequest(SIGNIN_METHOD);
boolean isConnected = bindService(new Intent(IPrimary.class.getName()),
mConnection, Context.BIND_AUTO_CREATE);
但isConnected每次都等于false。
在我的清单文件我有:
<service android:name=".DownloaderService">
<intent-filter>
<action android:name=".IPrimary" />
SI我不明白的问题。在logcat的出现:
I/ActivityManager(52):显示活动com.touristeye.code/.login文件:485918毫秒(共913151毫秒)
谢谢