Android :: Remote Service - Reconnecting

Aug 11, 2010

I have implemented a RemoteService which will increment a countere ( just for testing purposes ). Therefore I have a Task class which implements Runnable and the method run() where a infinite while loop increments the variable.

From the client side, I start the RemoteService with startService and then i bind to the service. When I close the activity, the service is still running. Now i want to rebind to the service.

How do I know if the service has already been started (therefore i would only need to bind to the service again) or not (then I would need to call startService() first and then bind to the service)?

What would happen, if I call startService() if the service is already running? Does the OS start a second service, or will it affect the service which is already running?

Android :: Remote Service - Reconnecting


Android :: Local Service Vs Remote Service

Nov 9, 2010

I'm confused about whether I need to run my service in a separate process. What are the advantages / disadvantages of each?For reference I'm trying to create an App that uses a service to play [streaming] audio in the background. So which one is better for my use case?

View 1 Replies View Related

Android :: Does Service Have To Be Remote Service Or Can It Still Be Local?

Sep 30, 2009

i have an app that binds to a local service.I want to add a desktop widget that binds to the same service. does my service have to be a remote service or can it still be local?if it can still be local, how can I get at the local binder?

View 2 Replies View Related

Android :: Android Remote Service Doesn't Call Service Methods

May 28, 2010

I'm developing a GPS tracking software on android. I need IPC to control the service from different activities. So I decide to develop a remote service with AIDL.This wasn't a big problem but now it's always running into the methods of the interface and not into those of my service class. Maybe someone could help me?If i now try to call a method from an activity for example start(trackId) nothing happens. The binding is OK. When debugging it always runs into the startTracking() in the generated ITrackingServiceRemote.java file and not into my TrackingService class. Where is the problem? I can't find anything wrong.

View 1 Replies View Related

Android :: Using Remote Service From Other App

Sep 24, 2009

I've implemented remote service using aidl & it is working fine if I'm using its service from same package. But If I tried to use the service from other application it gives me error

As below:

CODE:...................

View 3 Replies View Related

Android :: API Demo Remote Service Example

Sep 22, 2009

I am studying RemoteService example in Android's APISample. In the manifest file, it declares the service like this: My question is how can I specify the service to be 'auto-start', i.e. it gets start whenever the phone start?

<service android:name=".app.RemoteService" android:process=":remote" >
<intent-filter>
<!-- These are the interfaces supported by the service, which
you can bind to. -->
<action

android:name="com.example.android.apis.app.IRemoteService" />

View 1 Replies View Related

Android :: How To Execute A Remote Service

Jul 28, 2010

I have a service MyService.java in Application "ServiceDemo". The manifest of this application looks like this

CODE:.............

I have another application "CallerService" manifest looks like this

CODE:................

I have an activity from where I m trying to start the service on the click of the button

CODE:................

This fails to work. Says "unable to start service intent"

View 1 Replies View Related

Android :: Activity Starts Remote Service

Oct 8, 2010

My initial activity is basically a splash screen while preforming initialization and login in to network server. To save memory I want to finish() the splash activity once it starts the main menu activity. I still want the remote service to operate. Testing shows it does. But am I going to get into trouble doing this? I know I can restart the remote from the main menu activity but I am trying to save overhead by not starting it twice. The remote service is required by the splash activity.

View 1 Replies View Related

Android :: Access Remote Service In Different Application

Apr 30, 2010

I defined a remote service over a AIDL file. Now i want to access this service in a different application. But how can I do that? The AIDL file is not accessible in my second application, and if i just copy the AIDL file, then the service can't be found.

View 1 Replies View Related

Android :: Broadcast Receiver And Remote Service

Jan 20, 2010

I'm hoping to do some audio processing in a remote service (service I've spawned onto its own thread); this will basically occur in a while (1) loop so constant processing. Occasionally I want to provide some information back to the activity that is bound to the service; I'm doing this by sending a broadcast from the service, that is received by a broadcast receiver on the activity, which then uses the activity's service connection to call into the service and get the information needed; at this point the broadcast receiver makes an alert dialog presenting the information to the user.If I stay in my while(1) loop after raising the broadcast, the action in the broadcast receiver never seems to occur.This is confusing to me since the activity and service are in separate threads.If I end the loop after raising the broadcast, the desired behavior on the activity side occurs, but of course this isn't acceptable since I need to be doing constant processing.

View 11 Replies View Related

Android :: Does Use Of A Remote Service Help Avoiding GC Lags

May 18, 2010

Since yesterday I got an idea running around my mind but I donīt know first if it would work, and then how "hack" it would be.

People who develop audio processing/recording/playback apps for Android know how hard it is to maintain GC away from our critical paths: playing and recording audio. Processing must be as optimized as possible not only to save battery and use less CPU, but also not to create new objects/allocate new memory spaces ... this all to avoid GC at all cost. Well, we have knowledge and this we can handle (mostly). But what about all the other processing that happens from and for user interaction? Media players display images, some apps display ads, ... and sometimes we have to avoid releasing features to the users just to maintain our critical paths free from GC.

Yesterday I stumbled upon an article about remote services and this led me to a doubt: if they can run as a different process, would a GC call from my activity impact the performance of my remote service? I really donīt know how GC works on the Dalvik so this may be a dumb question. If so, I apologize.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 4 Replies View Related

Android :: Provide Sample Remote Service Example?

May 6, 2010

Can any one provide sample Remote service example. I want it like two different application. One application should contain service. Another application should use that service.
Thanks in adv....

View 1 Replies View Related

Android :: Binding A Remote Service From An Activity

Nov 23, 2009

I am binding a remote service from an activity and unbind the same on the onPause of the Activity,when the activity again restarts i bind the service .It does bind with the remote service and i am also successful in getting the remote-service method getting executed after the restart.But when returning a message from the callback-RemoteCallbackList.the mCallbacks.beginBroadcast returns me 0 clients.Am i missing some thing here ?why am i am getting zero clients when I call mCallbacks.beginBroadcast.?

CODE:....................

View 2 Replies View Related

Android :: Services - Remote Service - Diffrence?

Apr 21, 2010

"Service" by it's defenision meaning the same as "Remote service" in Android? and if not, what is the diffrence between them?

View 1 Replies View Related

Android :: Step Through Code In Remote Service

Aug 15, 2009

Is there a way to step through code in a remote service? What I do now is install the service, then run the app that starts it and use trace output. Is there a way to perhaps automatically start the service upon installation, and have it stop at break points? Or is there another method?

View 2 Replies View Related

Android :: Running Activity From Remote Service

Apr 29, 2010

Iam trying to run an activity from diffrent package from my remote service:

This is how i implement the service.java

CODE:....

Ive also added a line in the manifest of the service:


The service works fine, but i cant run the activity -> PushActivity which is in diffrent package of diffrent application, this is the error:

Activity not found Exception: No Activity found to handle Intent {act=com.pushservice.PushServiceActivity flq=0x10

View 2 Replies View Related

Android :: Multithreading And Progress Dialog With Remote Service

Apr 28, 2010

I like to do some long running initializing work in a remote service, and during that, a progress dialog shall be shown. So basicly, I invoke ProgressDialog.show, run a oneway method of the service with a callback to be invoked when it's finished, and in the callback dismiss the dialog. I expected the service method to work in it's own process while the activity shows the progress dialog. But what happens instead (according to debugger and logs) is: ProgressDialog.show and service method invocation return immediately, then the service method is processed, and finally the progress dialog is shown for a few milliseconds right before it's dismissed. Even a "not responding" error might occur during that. If I invoke the service method in an own thread, which (as it's to be expected) is finished long before the service method is done, everything works fine. But I don't get why this is necessary. Why does a remote service method block the Activity thread? This even happens if the service method only does a Handler.post and returns immediately.

Simplyfied code overview: Activity: public void onStart() { startService(...); bindService(...);}

View 2 Replies View Related

Android :: Bind Remote Service - That Installed On Device

Sep 5, 2010

I have coded this service, that computes stuff and i want other applications to be able to bind this service, i.e. i want to enable other programmers to communicate with this service. problem is, this has to work without these other programmers to get access to the source code. just the (installed) apk with the remote service is given (and of course a detailed description of the service' interface)...problem is, eclipse keeps braggin' about that the packages of the service are not available in source code...

View 1 Replies View Related

Android :: Aidl Remote Service Call Namespace

May 16, 2009

I didn't find a sufficient answer to my problem in any posts, if there already is one, please excuse and point me to it, thanks. I made 2 projects. project 1 hast an activity that binds to a service from project 2 on a button click (all just for testing).

How can I make project 1 know (import) my TestInterface (from TestInterface.aidl out of project 2) for usage in: "TestInterface mService = (TestInterface) TestInterface.Stub.asInterface(service);"

without adding project 2 to the build path, because if I'd have an installed service without the project code, I couldn't do it this way, too...?? I read in one thread that TestInterface.aidl should just be added to project 1, too, but if I do this, in DDMS enforceInterface() complains and seems to just see/use the interface from project 1 and it doesn't work.

2. issue:...............

View 9 Replies View Related

Android :: Remote Service Returning Value From Http Transaction

May 6, 2009

I've been researching how to best implement a service which performs a network transaction and returns data to the caller.

Clearly, this needs to happen on its own thread which means some form of async response. I can see at least three ways of doing this--some more complex than others. In the descriptions below, C is the caller, S is the service.

1) C wraps a Handler in a Messenger object, adds this to an Intent. C then calls startService with this intent. S extends IntentService which runs the Intents received in a worker thread. S then sends a message to C via the Messenger. This has the benefit of not requiring any of the async binding process or making an IDL interface that needs to be compiled into C. This seems to be the closes to a Handler-based response mechanism of Local Services.

2) C binds to S and then uses AsyncTask<> to make a blocking call to S. S performs the network transaction and returns the data in the return value or an out parameter. This requires the async binding process, but does not require a callback function since the inter- thread communications is handled by AsyncTask<> and the worker thread is in C's context.

3) Make the function called in S be completely asynchronous. S defines two interfaces: IMyService and IMyServiceCallback. S implements IMyService.Stub. C implements IMyServiceCallback.Stub. C binds to S then calls S via IMyService, passing its IMyServiceCallback binder. S spins up a worker thread and returns immediately. S then calls the callback when it has completed the network transaction.

I am asking for advice on which methods are most appropriate. I do not need the the service running constantly, only when the web transaction is required. C does not use S all the time--definitely don't want to bind during C's onCreate. However, I would like the time from when C determines it needs to use S to getting the results back to be as quick as possible (i.e. adding minimal latency to the already latent network access).

Is there any preference to having the worker thread in C or in S? Are there any significant problems with option 1?

View 11 Replies View Related

Android :: Retrieving List Type From Remote Service

Aug 15, 2009

I am having trouble passing a List type from a remote service to the UI activity. Here is a modified version of RemoteService example from the APIDemo. (only included where its modified)

PROBLEM: The call back function (for List) is called successfully, but the List returned is empty...

It works fine when the service does not run in a remote process. (w/o android:process=":remote" in the manifest file)

Why is this happening...?

Also, when I tried Map type, it didn't even successfully generate a IRemoteServiceCallback.java file.... it tries to do new Map().... and complains that its an abstract class.. (FYI, List instantiates by new ArrayList())

1. in IRemoteServiceCallback.java oneway interface IRemoteServiceCallback { /*** Called when the service has a new value for you. */void valueChanged(int value); void valueChangedList(out List values); void valueString(String value);}

View 2 Replies View Related

Android :: Remote Service Destroyed When Main Activity Closed / How To Fix?

Nov 19, 2010

I wrote an android program that: has a main activity for UI, and it starts a service. The service timely callbacks the UI activity to update views. It works fine except: if the activity is closed (with BACK) and start again, the service will also be started again (The service plays audio file, so there are two overlapped sounds). I use bindService with BIND_AUTO_CREATE flag to start and connect to service. According to the document, it should create service only if it doesn't exist, but obviously it starts another instance when opened second time. All I want is when the activity is closed, the service goes on running, and when the activity opens again, it can reconnect to the service. Is that possible? Or I just misunderstand the usage of service?

View 1 Replies View Related

Android :: Remote Process - Service Fetches Data From Network

Sep 15, 2009

I needed to call a remote service. The service basically fetches data from the network. I am bind the connection once,and then I unbind the connection when the user is no more in that page. Everything works fine.Except that when I call the sa,e remote method for 17th time,it just does not call the service at all.It neither throws the DeadObjecti Exception. I have run out of ideas.Is there anything that I may be missing.

View 7 Replies View Related

Android :: How To Identify Which Client Called Into A Remote/AIDL Service

Jul 26, 2010

In the implementation of my remote service's published API, is there a way to identify which client called a given method? For example, is there a way to obtain a unique ID or address of the caller? I already cache an AIDL callback reference to the client, but not sure how I can use this for identification.

View 4 Replies View Related

Android :: How To Pass Complex Data Structures Between Service And Remote Binder?

Feb 17, 2010

The object passing between an Android service and the remote binder is happening through serialization of the object. If the service needs to return a very large collection, it seems very inefficient to use this. What is the recommended way to deal with this?

View 1 Replies View Related

Android :: Unbind Remote Service In OnDestroy Of Activity On Screen Orientation Change

Nov 24, 2010

In onCreate method of Activity, it binds to a remote service and makes use of AIDL intefaces. Is it required to unbind from the remote service when onDestroy is called on screen orientation change.?

If the activity un-bounded from the remote service in onDestroy and if no other contexts are bound to remote service, is remote service likely to get stopped losing the state that it maintains.?

View 1 Replies View Related

General :: Remote Desktop App With PC Server As Service

Jul 17, 2013

Any app that has a PC server which can start as a service?

View 2 Replies View Related

Android :: How To Start A Remote Service In Android That Is Implemented In Another App - Different Package

Jun 19, 2010

i'm a bit stuck with remote services in android. thing is i implemented a remote service in package "a.b.c" and i want other applications to be able to access this service. i got rid of the whole crappy aidl-stuff and designed the "interface" of the service to work via broadcasted intents. works fine so far...

problem is: how do i get a different application (different package, different project, maybe even a different developer, ...) to start/stop the service?

CODE:..........

This will crash my app immediately on startup. what did i do wrong? how will i get this to work?

once it's running, commands and data will be passed via broadcasts. so that should be no real problem...

View 1 Replies View Related

Android :: Ways That Android Can Connect With A Remote Service

Jul 21, 2010

I am trying to write an Android app to connect to an existing web service. I'm pretty new to web services in general, other than what I've done with this first web services (written with JSPs, Struts 1.x, and JAVA). This web service is connected to a document storage database. The user would first login to the service, then using search parameters (document title, type, etc.) the user would be displayed a list of possibly relevant documents. The user would choose a specific document from that list, and the service would then stream the entire document (pdf file) to the user for viewing.What methods are available to Android where I can make a request given some specific parameters, and be able to parse a response?The only thing I know of is HTTP, but my project leader (I'm a summer intern) is hinting that there are others available. I'm not sure where to start looking.

View 4 Replies View Related

Android :: Remote Service Process Persists - I.e. Won't Disappear From Process Table

Feb 21, 2009

At a certain point in my program, when I'm completely done with my service, my activity executes unbindService() and stopService() -- yet the process persists. I can tell that it persists because I run "ps" in "adb -e shell":

CODE:.............

"adb logcat", I can show you the sequence of events:

ACTIVITY: context.unbindService(serviceConnection);

SERVICE: onUnbind();

ACTIVITY: stopService(serviceIntent); & returns true!

SERVICE: onDestroy();

First, my activity calls unbindService(serviceConnection). According to the documentation, unbindService() will "Disconnect from an application service. You will no longer receive calls as the service is restarted, and the service is now allowed to stop at any time." So that is fine, and it is happening.

Appropriately, we see the onUnbind() call happen on the service side. According to the documentation, onUnbind() is called when "all clients have disconnected from a particular interface published by the service." So this confirms the correct service connection is being passed, and that the service is responding accordingly.

Next, my activity calls stopService(serviceIntent), and returns true. According to the documentation, stopService() does the following: "If there is a service matching the given Intent that is already running, then it is stopped and true is returned; else false is returned." Again, this is happening and returning true.

In response, the service's onDestroy() method is called. According to the documentation, onDestroy() is "Called by the system to notify a Service that it is no longer used and is being removed. The service should clean up any resources it holds (threads, registered receivers, etc) at this point. Upon return, there will be no more calls in to this Service object and it is effectively dead."

At this point I expect the process to disappear from the process table. Yet it remains indefinitely. But why?

Also, the process is so persistent that I can bind to it again, and I see that it is the same exact process responding because the PID (process ID) is the same!

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved