views:

539

answers:

1

Hi, i have a problem with bindService. In my Activity i have the following code:

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);

But isConnected is equals to false every time.

In my manifest file i have:

        <service android:name=".DownloaderService">
  <intent-filter>
<action android:name=".IPrimary" />

si i don't understand the problem. In logcat appears:

I/ActivityManager( 52): Displayed activity com.touristeye.code/.LogIn: 485918 ms (total 913151 ms)

Thank you

+1  A: 

Expand that action:name to be the full value in the <action> element. It may be that the dot-prefix shorthand only works for the component element (e.g., <service>).

CommonsWare
thanks!! it works.
xger86x