[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-15 Thread Sunil . Maharana
After i set the build path it is compiled fine no more erros. Bu the 
moment i wanna to call the Interfaces like registerCallback, its giving 
few errors as below:

02-16 10:31:15.413: ERROR/JavaBinder(278): *** Uncaught remote exception! 
(Exceptions are not yet supported across processes.)
02-16 10:31:15.413: ERROR/JavaBinder(278): java.lang.RuntimeException: 
Can't create handler inside thread that has not called Looper.prepare()
02-16 10:31:15.413: ERROR/JavaBinder(278): at 
android.os.Handler.(Handler.java:111)
02-16 10:31:15.413: ERROR/JavaBinder(278): at 
android.widget.Toast.(Toast.java:397)
02-16 10:31:15.413: ERROR/JavaBinder(278): at 
android.widget.Toast.makeText(Toast.java:230)
02-16 10:31:15.413: ERROR/JavaBinder(278): at 
com.android.TestService.TestService$2.registerCallback
(TestService.java:103)
02-16 10:31:15.413: ERROR/JavaBinder(278): at 
com.android.TestService.ITestService1$Stub.onTransact(ITestService1.java:58)
02-16 10:31:15.413: ERROR/JavaBinder(278): at 
android.os.Binder.execTransact(Binder.java:276)
02-16 10:31:15.413: ERROR/JavaBinder(278): at 
dalvik.system.NativeStart.run(Native Method)

Has anyone tried it. Here i have added two projects as(TestService and 
ServiceMonitor) in a same workspace, in ServiceMonitor i am trying to call 
the interfaces exposed by TestService using AIDL.

Thanks & Regards,
Sunil




Hans  
Sent by: android-developers@googlegroups.com
02/14/2009 10:05 PM
Please respond to
android-developers@googlegroups.com


To
Android Developers 
cc

Subject
[android-developers] Re: Unable to start service Intent error in 
Client-Server project







Make sure you have added TestService to your build path for the
service monitor :).

I'm new to Eclipse myself :).

The two projects are in the same workspace, yes?  Just different
folders I presume?

The zip file I provided was the contents of my workspace, it had those
two folders in it.

You should be able to create a blank workspace in Eclipse, put the
contents of the zip file (the two base project folders) into that
blank workspace through your file manager/explorer in your OS, then
back in Eclipse, choose File|Import|General|Existing Project and
import both projects.  It should build after that.


__



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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Dianne Hackborn
On Sat, Feb 14, 2009 at 1:14 PM, Hans  wrote:

> I'm not trying to be argumentative for the sake of being argumentative
> Dianne, but if that was the case, how could the IPC calls to the
> remote process be resolved if they are only declared in the manifest
> for the service project which is in a different *.apk?  This would
> mean that android was accidentally (presumably) bypassing the
> requirement to declare your exposed service interfaces in your
> manifest.


I don't have your code here to run to tell you exactly what is going on, I
can just tell you what I see posted, and what I see is that you have your
service declared in a package like this:

http://schemas.android.com/apk/res/android";
 package="com.android.TestService"

Note the package name "com.android.TestService"

And the error message you are getting is this:

"02-12 14:16:23.531: WARN/ActivityManager(50): Unable to start service
Intent {
comp={com.android.servicemonitor/com.android.TestService.TestService} }: not
found"

Note the component that is trying to be started is in the package name
"com.android.servicemonitor".

If putting a declaration of the service in your servicemonitor package
causes things to work, then the only way I can possibly see this happening
is that it is now successfully finding the component
"com.android.servicemonitor/com.android.TestService.TestService" which due
to the package name MUST be a component in your servicemonitor client
package, so it must be running the implementation there.

Maybe I am missing some part of what you are doing, but that is what I see
at this point.

BTW, I would presume that there is an implementation of the class in
> the local client's *.apk because otherwise the client would have to
> use late/explicit binding to the interfaces exposed by the service...
> This should be true anytime you write a client.


That is not true at all, the only thing the client needs is the interface to
the class.  If you are using aidl then this would be the Java classes
created for ITestService.aidl or whatever you call the interface
definition.  And if you don't use aidl (by using a Messenger to send
messages to the service, or direct transact() calls on its IBinder), then
you don't need any service-related code in your client at all.


> Either it should be impossible to start a remote service from a class
> name or some other local to the client reference, or
> the operating system should handle starting a remote service from a
> class name 'properly' so that the main service thread can callback
> into the client instead of just the service's thread pool being able
> to.


Sorry I don't quite understand what you are saying here.  Ultimately the
Intent you use to bind to the service is either going to be abstract, and
the package manager will try to find the concrete component matching that
intent for you, or it will be like you are doing here where you supply a
concrete ComponentName for the actual component you want.  In the latter
case, the ComponentName consists of the package name of the .apk holding the
component plus the full name of the component inside of that .apk.  And then
either that component exists in that .apk, or it doesn't, and there is
really nothing else to it.

One thing that may be confusing is that "new Intent(this, MyClass.class)" is
a short-hand for creating an Intent with an explicit ComponentName for
component in your -own- package.  It can not ever be used to reference
component in other packages.  To do that you will need to manually create a
ComponentName() with the proper strings.


> In either case, it would be nice if the documentation about starting
> services recommended using a global service name for starting remote
> services, although I would certainly know less about Android if that
> were the case, lol...


I am still confused. :}  Ultimately it is a ComponentName that names the
service to start, and that is unambigous and you can see right in the error
output exactly what it is.


> Is there a formal specification for the behavior of services in this
> regard?


It's basic Intent matching, the exact same thing as is used for activities
and receivers, and should be fairly well covered in the Intent class.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Hans

Fixed and re-uploaded in case anyone else uses it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Hans

Crud Suni - I accidentally left an error call (from when I was testing
out the weirdness of service creation the 'wrong' way) in the
"StartService" method in the Service Monitor class...

Right below the comment "//Attempt to start the service" there's a
call:

startService( new Intent( this, TestService.class ) );

THAT is not supposed to be there because it is started properly right
below it using the TEST_SERVICE name.

Sincerest apologies, I was using the other line to trace behavior when
it was created 'incorrect' (although the framework didn't complain.)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Hans

On Feb 14, 3:12 pm, Dianne Hackborn  wrote:
> On Sat, Feb 14, 2009 at 7:38 AM,  wrote:
> > import com.android.TestService.*;
>
> Is this code part of the android platform?  No?  Then please don't use this
> namespace.  Thanks. :)
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com

Apologies, just for my first two tests :).

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Hans

I'm not trying to be argumentative for the sake of being argumentative
Dianne, but if that was the case, how could the IPC calls to the
remote process be resolved if they are only declared in the manifest
for the service project which is in a different *.apk?  This would
mean that android was accidentally (presumably) bypassing the
requirement to declare your exposed service interfaces in your
manifest.

BTW, I would presume that there is an implementation of the class in
the local client's *.apk because otherwise the client would have to
use late/explicit binding to the interfaces exposed by the service...
This should be true anytime you write a client.

The bone of contention appears to be one of two things.

Either it should be impossible to start a remote service from a class
name or some other local to the client reference, or
the operating system should handle starting a remote service from a
class name 'properly' so that the main service thread can callback
into the client instead of just the service's thread pool being able
to.

In either case, it would be nice if the documentation about starting
services recommended using a global service name for starting remote
services, although I would certainly know less about Android if that
were the case, lol...

Is there a formal specification for the behavior of services in this
regard?

I certainly don't mean any of my comments to sound critical of
Android, it really is fantastic (if given to renaming things that had
perfectly valid names before :) ), and VERY easy to use.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Dianne Hackborn
On Sat, Feb 14, 2009 at 7:38 AM,  wrote:

> import com.android.TestService.*;


Is this code part of the android platform?  No?  Then please don't use this
namespace.  Thanks. :)

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Dianne Hackborn
There apparently is an implementation of that class in your local client
.apk.  It is very clear from the logs that the client is trying to interact
with -some- component in its package, as you can see right in the component
name.

On Thu, Feb 12, 2009 at 2:37 PM, Hans  wrote:

>
> On Feb 12, 5:09 pm, Dianne Hackborn  wrote:
> > I replied to this in the other thread, but if you want to explicitly
> > reference a component from one package that is in another, you need to
> > explicitly build the ComponentName of both the package and class name of
> the
> > target.  The shorthand new Intent(this, ...) creates ComponentName
> objects
> > whose package is your own -- it is only for references components in your
> > own package.
>
> Then how was it starting the service, binding it, and calling methods
> on the service's interface if the constructor for Intent was somehow
> mangling TestService.class?
>
> TestService.class resolves directly to
> com.android.TestService.TestService anyhow.
>
> Hans
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Hans

You should only need the AIDL file to reside in the TestService's
folder because the IDL compiler will find it there.  Again, make sure
you have your build path setup properly for Service Monitor.

Iirc, I tested this on a laptop I'd not used for anything and it built
for me straight away when I put the zip contents into a blank
workspace and then imported the two projects.

Good luck! :)

P.S. If problems continue, let me know and we'll work it out.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Hans

Make sure you have added TestService to your build path for the
service monitor :).

I'm new to Eclipse myself :).

The two projects are in the same workspace, yes?  Just different
folders I presume?

The zip file I provided was the contents of my workspace, it had those
two folders in it.

You should be able to create a blank workspace in Eclipse, put the
contents of the zip file (the two base project folders) into that
blank workspace through your file manager/explorer in your OS, then
back in Eclipse, choose File|Import|General|Existing Project and
import both projects.  It should build after that.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-14 Thread Sunil . Maharana

Hi Hans, Thanks for your help Hans, i have created two projects same as your project name and added your files, the TestService project is fine, but for  ServiceMonitor project it is giving error at the import statement only.It is not allowing to import the TestService as  "The import 'com.android.TestService.*' cannot be resolved"import com.android.TestService.*;I have created two projects as C:\Project\Andriod\workspace  for TestServiceC:\Project\Andriod\workspace1  for Service MonitorDo i need to setup some kind of settings in my windows,could you plz give some clue about how i have to keep those files so that when i will run those it won't give me the import error.As per my knowledge the AIDL files we have to execute at both the end , i mean at TestService and Service Monitor site, but yoiu have execiuted it only TestService site, plz correct me if i am wrong.Thanks n RegardsSunil-android-develop...@googlegroups.com wrote: -To: Android Developers From: Hans Sent by: android-developers@googlegroups.comDate: 02/13/2009 07:39PMSubject: [android-developers] Re: Unable to start service Intent error in Client-Server projectHere's the URL: http://www.plugin-factory.com/storage/workspace.zipThere are two projects in it:    (1)ServiceMonitor - a simple activity that has 3 buttons and atext view.  One buttons starts and binds to the service, the otherstops and unbinds from the service, the third is a query button thatwas used to test some functions of the service that were related tochecking network status (but that's not important now and I erasedthat code to keep it clearer.)    (2)TestService - an out of process service that exposes twointerfaces (there are 3 AIDL files in the project, one for eachinterface, and another interface that exposes the callback mechanismto interested clients), the first interface allows you to register/unregister for callbacks, the second is just a test interface to showyou can expose multiple interfaces and on a service and bind to theones you want.That's pretty much it.The ServiceMonitor project imports from the TestService in order touse the interfaces, and the TestService project manifest specifies aglobal service reference name of "TEST_SERVICE" and also denotes thatthe service runs in its own process.    Hope this helps :).    Hans
__


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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-13 Thread Hans

Here's the URL: http://www.plugin-factory.com/storage/workspace.zip

There are two projects in it:

 (1)ServiceMonitor - a simple activity that has 3 buttons and a
text view.  One buttons starts and binds to the service, the other
stops and unbinds from the service, the third is a query button that
was used to test some functions of the service that were related to
checking network status (but that's not important now and I erased
that code to keep it clearer.)

 (2)TestService - an out of process service that exposes two
interfaces (there are 3 AIDL files in the project, one for each
interface, and another interface that exposes the callback mechanism
to interested clients), the first interface allows you to register/
unregister for callbacks, the second is just a test interface to show
you can expose multiple interfaces and on a service and bind to the
ones you want.

That's pretty much it.

The ServiceMonitor project imports from the TestService in order to
use the interfaces, and the TestService project manifest specifies a
global service reference name of "TEST_SERVICE" and also denotes that
the service runs in its own process.

 Hope this helps :).

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-13 Thread Hans

Sunil, I'll zip up my test projects (a client in its own package and
*.apk and a remote service it its own package, and *.apk, exposing 2
interfaces and using callbacks into the client), I'll post the URL
here when I've done it.

Hope it helps :).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-13 Thread Android

Hi All,

When my client code calls bindService it was fine and it calls
onServiceConnected, there i am calling the interface method using the
.Stub.asInterface(service) object and there only it gives me bunch
of error as:

02-13 17:14:52.239: WARN/Parcel(1035):  enforceInterface()
expected 'oem.android.proj1.IRemoteService' but read
'oem.android.proj2.IRemoteService'
02-13 17:14:52.249: DEBUG/AndroidRuntime(1071): Shutting down VM
02-13 17:14:52.249: WARN/dalvikvm(1071): threadid=3: thread exiting
with uncaught exception (group=0x40010e28)
02-13 17:14:52.249: ERROR/AndroidRuntime(1071): Uncaught handler:
thread main exiting due to uncaught exception
02-13 17:14:52.259: ERROR/AndroidRuntime(1071):
java.lang.SecurityException: Binder invocation to an incorrect
interface
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.os.Parcel.readException(Parcel.java:1234)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.os.Parcel.readException(Parcel.java:1222)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
oem.android.proj2.IRemoteService$Stub$Proxy.display
(IRemoteService.java:108)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
oem.android.proj2.RemoteServiceBinding.onListItemClick
(RemoteServiceBinding.java:147)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.app.ListActivity$2.onItemClick(ListActivity.java:312)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.widget.AdapterView.performItemClick(AdapterView.java:283)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.widget.ListView.performItemClick(ListView.java:3049)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.widget.AbsListView$PerformClick.run(AbsListView.java:1415)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.os.Handler.handleCallback(Handler.java:542)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.os.Handler.dispatchMessage(Handler.java:86)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.os.Looper.loop(Looper.java:123)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
android.app.ActivityThread.main(ActivityThread.java:3742)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
java.lang.reflect.Method.invokeNative(Native Method)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
java.lang.reflect.Method.invoke(Method.java:515)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
02-13 17:14:52.259: ERROR/AndroidRuntime(1071): at
dalvik.system.NativeStart.main(Native Method)

My Server and Client code both are in different package i mean in
different .APK.

I have ran the Service code first and these are the below files i am
using:
IRemoteService.aidl -> have the interfaces
DisplayPage.java --> Activity that starts the RemoteService.java
RemoteService.java  --> Service and impliments the interface methods

AndroidManifest.xml code:





  




 


IRemoteService.aidl  code:
package oem.android.proj1;

interface IRemoteService{
void display();

RemoteService.java  code:
package oem.android.proj1;
public class RemoteService extends Service {
public void onCreate() {
super.onCreate(); }
public IBinder onBind(Intent intent) {
If (IRemoteService.class.getName().equals(intent.getAction())){
return mBinder; }
return mBinder;}}

private final IRemoteService.Stub mBinder = new IRemoteService.Stub(){
public void display(){
Toast.makeText(RemoteService.this, "RemoteService -- display
function",
Toast.LENGTH_SHORT).show();}
};}


Then i ran the Client code and these are the below files i am using:
IRemoteService.aidl -> have the interfaces
RemoteServiceBinding.java --> Activity that that calls the bindService
and calls the Service's methods.
AndroidManifest.xml code:










IRemoteService.aidl  code:
package oem.android.proj1;

interface IRemoteService{
void display();

RemoteServiceBinding.java code:
package oem.android.proj2;

public class RemoteServiceBinding extends ListActivity {
private Context ctx;
IRemoteService mService = null;
private String[] mStrings = {"Bind", "Conn"};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
X}

private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName
className,IBinder service) {
mService = IRemote

[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-13 Thread Sunil . Maharana
ublic void onServiceConnected(ComponentName className,IBinder 
service) {
mService = IRemoteService.Stub.asInterface(service);
 
}
public void onServiceDisconnected(ComponentName name) {
mService = null;}
};
protected void onListItemClick(ListView l, View v, int position, long id)
{
if(position ==0)
{ 
bindService(new Intent(IRemoteService.class
.getName()),
mConnection, Context.BIND_AUTO_CREATE);

}
if(position ==1)
{
 try {
mService.display();
} catch (RemoteException e) {
// TODO Auto-generated 
catch block
e.printStackTrace();
}   } 
}


i have set the ListItem listener when i press my bind one it should call 
the bindService and it is doing correctly, but when i click the Conn it 
should call my   display() method but is giving me errors that i have 
mentioned on the top.

Can someone plz help me what went wrong on my code, i am assuming that 
some thing broken in my AndroidManifest.xml code only.

Actually i am still in dilema what all thing to set in AndroidManifest.xml 
file in both Client and Server site, like permisson or any other things.

Thanks & Regards,
Sunil





Hans  
Sent by: android-developers@googlegroups.com
02/13/2009 01:40 AM
Please respond to
android-developers@googlegroups.com


To
Android Developers 
cc

Subject
[android-developers] Re: Unable to start service Intent error in 
Client-Server project







On Feb 12, 2:47 pm, Dianne Hackborn  wrote:
> Um.  This is the package your service is in:
>
> http://schemas.android.com/apk/res/android";
>  package="*com.android.TestService*"
>
> And yet you are trying to start a service in the other package:
>
> Unable to start service
> Intent { 
comp={*com.android.servicemonitor*/com.android.TestService.TestService}

That's what the error is, I'm simply calling start service like this:

if( null == startService( new Intent( this, TestService.class ) ) )
{
 if( null != in_oOutput )
 {
 in_oOutput.append( "\nstartService 
returned 'null'" );
 }

 return false;
}


My client class has imported TestService via:

import com.android.TestService.*;

So, I'm wondering why, unless I declare the service in the client's
manifest as I explained before (and change absolutely nothing else)
does it work just fine, but without the service line in the client
manifest it is trying, for some reason, to find it in the wrong place.

When it works, the activity manager reports in the log:

"02-12 15:08:43.541: INFO/ActivityManager(50): Start proc
com.android.servicemonitor:remote for service
com.android.servicemonitor/com.android.TestService.TestService:
pid=621 uid=10018 gids={}"

So it would seem that com.android.servicemonitor/
com.android.TestService.TestService is perfectly fine.

 Hans


__



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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Hans

On Feb 12, 5:09 pm, Dianne Hackborn  wrote:
> I replied to this in the other thread, but if you want to explicitly
> reference a component from one package that is in another, you need to
> explicitly build the ComponentName of both the package and class name of the
> target.  The shorthand new Intent(this, ...) creates ComponentName objects
> whose package is your own -- it is only for references components in your
> own package.

Then how was it starting the service, binding it, and calling methods
on the service's interface if the constructor for Intent was somehow
mangling TestService.class?

TestService.class resolves directly to
com.android.TestService.TestService anyhow.

 Hans

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Dianne Hackborn
I replied to this in the other thread, but if you want to explicitly
reference a component from one package that is in another, you need to
explicitly build the ComponentName of both the package and class name of the
target.  The shorthand new Intent(this, ...) creates ComponentName objects
whose package is your own -- it is only for references components in your
own package.

On Thu, Feb 12, 2009 at 12:37 PM, Hans  wrote:

>
> It turns out that you can avoid using the service reference in your
> client manifest if you declare what I presume is a global name in your
> service's manifest and simply refer to this name in your client code.
>
> This is what I added to my service's manifest:
>
> 
>
> Then I could delete the  entry in my client's manifest.
>
> I still can't get my service to trigger callbacks on the service's
> main UI thread.
>
> Weirdly enough, I have found that the thread pool thread ID will
> differ, on occasion (of course) when a client calls in to register
> their callback, but each of the thread pool's thread can broadcast on
> the RemoteCallbackList's items while the main thread cannot...
> Crazy...
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Hans

It turns out that you can avoid using the service reference in your
client manifest if you declare what I presume is a global name in your
service's manifest and simply refer to this name in your client code.

This is what I added to my service's manifest:



Then I could delete the  entry in my client's manifest.

I still can't get my service to trigger callbacks on the service's
main UI thread.

Weirdly enough, I have found that the thread pool thread ID will
differ, on occasion (of course) when a client calls in to register
their callback, but each of the thread pool's thread can broadcast on
the RemoteCallbackList's items while the main thread cannot...
Crazy...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Hans

On Feb 12, 2:47 pm, Dianne Hackborn  wrote:
> Um.  This is the package your service is in:
>
> http://schemas.android.com/apk/res/android";
>      package="*com.android.TestService*"
>
> And yet you are trying to start a service in the other package:
>
> Unable to start service
> Intent { 
> comp={*com.android.servicemonitor*/com.android.TestService.TestService}

That's what the error is, I'm simply calling start service like this:

if( null == startService( new Intent( this, TestService.class ) ) )
{
if( null != in_oOutput )
{
in_oOutput.append( "\nstartService returned 'null'" );
}

return false;
}


My client class has imported TestService via:

import com.android.TestService.*;

So, I'm wondering why, unless I declare the service in the client's
manifest as I explained before (and change absolutely nothing else)
does it work just fine, but without the service line in the client
manifest it is trying, for some reason, to find it in the wrong place.

When it works, the activity manager reports in the log:

"02-12 15:08:43.541: INFO/ActivityManager(50): Start proc
com.android.servicemonitor:remote for service
com.android.servicemonitor/com.android.TestService.TestService:
pid=621 uid=10018 gids={}"

So it would seem that com.android.servicemonitor/
com.android.TestService.TestService is perfectly fine.

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Dianne Hackborn
Um.  This is the package your service is in:

http://schemas.android.com/apk/res/android";
 package="*com.android.TestService*"

And yet you are trying to start a service in the other package:

Unable to start service
Intent { comp={*com.android.servicemonitor*/com.android.TestService.TestService}
}: not found"

On Thu, Feb 12, 2009 at 11:27 AM, Hans  wrote:

>
> It didn't work.  I commented out the service declaration in my
> Activity's manifest:
>
> 
>
> And modified my service's manifest to include 'exported' like this:
>
> 
> http://schemas.android.com/apk/res/android";
>  package="com.android.TestService"
>  android:versionCode="1"
>  android:versionName="1.0.0">
>
> android:process=":remote" >
>
>
> android:name="com.android.TestService.ITestService1"/>
> android:name="com.android.TestService.ITestService2"/>
>
>
>
> 
>
> And during runtime I got the old problem I had before adding the
> service line to my client's manifest:
>
> "02-12 14:16:23.531: WARN/ActivityManager(50): Unable to start service
> Intent { comp={com.android.servicemonitor/
> com.android.TestService.TestService} }: not found"
>
> I'm sure I'm just doing something totally noobishly dumb, but my dumb
> (lol) way I've got it working 99% of the way, now if I can just get
> the main service thread to actually find the callbacks that I know are
> in the RemoteCallbackList (but that's for another thread :)) - thanks
> for putting up with me Dianne.
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Hans

It didn't work.  I commented out the service declaration in my
Activity's manifest:



And modified my service's manifest to include 'exported' like this:


http://schemas.android.com/apk/res/android";
  package="com.android.TestService"
  android:versionCode="1"
  android:versionName="1.0.0">











And during runtime I got the old problem I had before adding the
service line to my client's manifest:

"02-12 14:16:23.531: WARN/ActivityManager(50): Unable to start service
Intent { comp={com.android.servicemonitor/
com.android.TestService.TestService} }: not found"

I'm sure I'm just doing something totally noobishly dumb, but my dumb
(lol) way I've got it working 99% of the way, now if I can just get
the main service thread to actually find the callbacks that I know are
in the RemoteCallbackList (but that's for another thread :)) - thanks
for putting up with me Dianne.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Hans

I will try that, thanks :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Dianne Hackborn
That really should not fix things. :}  I suspect that whatever is happening
now is really not what you want.  If the -real- service you are wanting to
bind to does not have an intent-filter, you need to make sure you use
android:exported="true" on it so other .apks can find it.  Also you can do
"adb shell dumpsys package" to get a big dump of everything that the package
manager things is on your phone, to see if your service is correctly
included in the intent filter mapping for services.

On Thu, Feb 12, 2009 at 10:07 AM, Hans  wrote:

>
> When I built my client/service code I had two projects, one for the
> client (the Activity) and a different project for my Service.
>
> Now, I spent about 3 hours struggling until I realized that for some
> reason (probably because I was using an out of process service) I
> needed to not only declare my service in the service project's
> manifest BUT ALSO in the client project's manifest in exactly the same
> manner (without the interface portions so just something like  blah blah blah process:remote/>), then bingo, my client stopped saying
> "not found."
>
> If you're using a multi-project approach (as I presume anyone would if
> they plan to have a re-usable service), make sure you've got  > declared in all your client application's manifests.
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Hans

When I built my client/service code I had two projects, one for the
client (the Activity) and a different project for my Service.

Now, I spent about 3 hours struggling until I realized that for some
reason (probably because I was using an out of process service) I
needed to not only declare my service in the service project's
manifest BUT ALSO in the client project's manifest in exactly the same
manner (without the interface portions so just something like ), then bingo, my client stopped saying
"not found."

If you're using a multi-project approach (as I presume anyone would if
they plan to have a re-usable service), make sure you've got  declared in all your client application's manifests.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Unable to start service Intent error in Client-Server project

2009-02-12 Thread Chandra Mouli
I tried a similar aidl thing a week ago.

I hope you r binding to the service like bindService(*new*Intent(IRemoteService.
*class*.getName()),Conn, Context.*BIND_AUTO_CREATE*);

Going by the error it looks like you missed the intent filter tag for your
service...
i.e.
 




On Thu, Feb 12, 2009 at 8:50 PM, Android wrote:

>
> Hi All,
>
> I am getting the below error when ever i am trying to call the bind
> service.
> 02-12 20:17:25.486: WARN/ActivityManager(58): Unable to start service
> Intent { action=oem.android.proj2.IRemoteService }: not found
>
> I have created the Client-Server application. At the Server site i
> have used the AIDL to impliment the interfaces in my Service class.
> At Client site i have exposed the AIDL interfaces and have one
> Activity that mainly do the IPC mechanism , i mean ServiceConnection,
> bindService and then call the Serivce of the Client site. But i am
> getting the error i mentioned during the bindService call.
>
> Could you please let me know the steps mainly i have to follow to run
> the Client -Server Application. For time being i am running the
> Client .apk first and then the Server .apk, but the server one giving
> me error.
>
> It would be great if you could let me know what all permission short
> of thing to take care, as my Client and Server code are placed at
> different APks, so do i need to import the Client project in my Server
> Project, if yes then how to impliment that.
>
> -Kumar
> >
>


-- 
G . chandra mouli

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