On Wed, Jun 23, 2010 at 9:57 AM, Krishna Shetty
<[email protected]> wrote:
> Thank you very much Mark, Joe.
>
> But below call i.e., binding with the Interface name is not working. I
> got the same error, "not able to bind, service not found.."
> bindService(new Intent(IScript.class.getName()), svcConn,
> Context.BIND_AUTO_CREATE);

That means you have no service with an <intent-filter> containing an
<action> string that matches the value generated by
IScript.class.getName(). If you are taking that code from one of my
samples, the corresponding manifest from those samples is set up
properly:

http://github.com/commonsguy/cw-advandroid/tree/master/AdvServices/RemoteService/

> But, below way of binding works. i.e., Binding with the exported
> Service.
> Intent i = new Intent();
> i.setClassName("com.mt.TestRemoteService",
> "com.mt.TestRemoteService.MyService");
> bindService(i, svcConn, Context.BIND_AUTO_CREATE);

This is extremely fragile. If the other application refactors its
code, your code will break.

> Why bind with Interface name is not working for me?
> ( Note: I have added an <intent-filter> on the <service> with a
> Interface <action> )

Whatever you think you did, it is not working.

Rather than use my IScript.class.getName() trick, it is probably
simpler for you to just use the literal string. Copy whatever string
is in your <action> and paste it as a string literal in your Intent
constructor.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.6
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to