Android :: Communicate Between Applications (service Vs Intents)

Sep 13, 2010

What is the difference between 2 ways of interaction between applications on android:

1. implementing service in app #1 and using it in app #2.
2. handling intentions and posting answer intention.

Android :: communicate between applications (service vs intents)


Android :: How Does A Service Communicate With Activity?

Feb 17, 2010

Suppose I have an Activity that's a list. It calls a Service when this Activity starts.The Service will do background stuff download, parse, and fill the list.My question is this: How can the Service communicate with the Activity?How can I call a method in the Activity, from the Service? (I'm new to OOP)

View 2 Replies View Related

Android :: Communicate With A Service From An Application

Aug 25, 2009

i have some problem to communicate with a service from an Android application.The service is in a first package "package com.myService" and the application in another on "package com.myApplication".My service work and start well but my next step is to add an AIDL interface to external applications.I have tried to follow the recomandation described here : http://developer.android.com/guide/developing/tools/aidl.html, but i have still the following error (given in the log service):W/ActivityManager( 568): Unable to start service Intent { action=com.MyApplication.IBootstrapService }: not found

View 2 Replies View Related

Android :: Service - Communicate With Activities

May 19, 2010

I'm wondering which is the best way to communicate between a Service and an activity..

Broadcast intent
Callback
others?...

View 1 Replies View Related

Android :: Getting Service To Communicate With Activity?

Jun 25, 2010

I currently have a Service and an Activity in my application.I currently bind the Service to the activity without using AIDL as the Service and the Activity are in the same application.This allows me to call the methods from the Service within my Activity when I require them, however it doesn't let me call the methods of the Activity from within my Service when I want to.Can anyone comment on what would be the best way to achieve this?I could use Intents but is there an alternative option?I want to have tight communication between the Service and the Activity, I want to be able to call an Activity method from my Service when an event happens.

I now have it working the way I want, however I have come across a problem.My service gets status updates and my Activity is then supposed to react to the update sent on from the Service.The problem is that when I start my activity I get the Dialling Status and then Connected status before the onBind is called and I get the instance of iCallDialogActivity.

I need to be able to use my iCallDialogActivity when I get the Dialling and Connected Status notifications.But this gives me a NullPointer Exception due to it not being created in time when my Activity starts, binding is the first thing I do in my Activities onCreate().Is there a way to make it bind straight away?

View 1 Replies View Related

Android :: Two Applications Communicate Using DBus

Nov 20, 2010

My intention is to let two applications communicate using DBus . i know that DBus is already integrated into android,Dbus binaries DBus send,DBus-monitor,DBus-daemon are already available. i am trying to create an application which will connect to the Dbus and start sending signals and messages over DBus . for this i have used basic DBus API's to establish connection to the bus.

I have written native code to connect to the DBus.here is the code

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

View 2 Replies View Related

Android :: Communicate Progress From Local Service

May 16, 2010

An application I'm building uses a local Service for downloading files from the web to the phone's SD card. In this app users can browse lists of books, and read them while online. A user can also download a pdf copy of a book for offline viewing. To handle downloads I'm using a locally bound Service. I do not want this Service to run all the time, only when downloading files. So that the Service can shut itself down when its tasks are complete, I am not binding to the service, rather I'm sending an "enqueue for download" command through the Intent passed to Context.startService.

Books available for download are shown in a list. A user can choose to download a book by clicking on its row in the list. On download, I need to show download progress using a ProgressBar on the actual book list row. I need to also show, on the rows, if a book is enqueued for download, or if its download has completed or failed. The books can be shown in different activities throughout the application--in search, or in the user's list of favorite books, for example. When the books are shown in different places, these are not the same objects, but they are uniquely identified by their bookId...............

View 1 Replies View Related

Android :: Want Activity / Service To Communicate With Intent

Aug 2, 2010

In the Activity I write Intent i=new Intent("IntentServiceTest"); Bundle bundle = new Bundle(); bundle.putString("abc", "def"); i.putExtra("wer", bundle); IntentTest.this.startService(i); Start Service into Service OnCreate method,but I don't know how to do get this Intent in this method.

View 11 Replies View Related

Android :: Best Way For Service That Starts Activity To Communicate With It

Feb 16, 2010

I have a service that listens to a socket. When receiving certain input it is to create an activity. When receiving other input, it is to kill this activity. I have struggled for a while to make the service communicate with the activity through AIDL (http://developer.android.com/guide/developing/tools/aidl.html), but this seems to not be effective. I think AIDL is only effective when the process that is to be talked to is a service, not when it is an activity? I would love some directions or suggestions on how to solve my problem.

View 1 Replies View Related

Android :: Easiest Way To Communicate Between Two Activities In Two Different Applications

Apr 30, 2010

I have an application A and a application B that both have an activity. Now i want to send Data from activity A1 to activity B1 and back. Whats the easiest way to to dis? I tried to use Remote Service via AIDL, but this doesn't work very well in both directions because I only can pass the primitives data types and not every object i like (ok i would have to implement parceable but this is not really practicle). Then i read this post by Dianne Hackborn.

View 5 Replies View Related

Android :: How To Communicate Back To Service From Broadcast Receiver?

Aug 17, 2010

I have a widget which starts a service. The service registers two broadcast receivers. I would like to send back intents from the receivers to the service, so that the service can react.I remember reading (on some blog) that this won't start a new service, but will simply pass the intent to the already running service. Is this correct? Is it a bad way of doing it? Is there a better way?

View 1 Replies View Related

Android :: How To Use Intents From Service Or Broadcast Receiver?

Dec 15, 2009

I need to be able to handle/catch Intents while my Activity is closed. So I am looking at either a Service or a BroadcastReceiver. Is it possible to "receive" intents to a service itself? I tried to search, but could not find anything helpful. With a BroadcastReceiver, I am not exactly sure how that works outside of an Activity. Does it depend on the Activity being open/running? Can it run by itself?

Let's say that my Activity is killed by Android(or a task killer app), does the BroadcastReceiver still receive intents and process them? I have used a BroadcastReceiver as a widget, but I do not want to use a widget this time. My goal is to have the user open the Activity to set some options. From there, they would be able to close the Activity, but I would still be able to process Intents that were sent out by the system. I am still fairly new to Android development, so I could be so far away from where I need to be.

View 1 Replies View Related

Android :: Background Service - Intents For Communication Between UI

Jul 6, 2009

I'm writing an application that consists of a background Service and one or several Activities acting as UI towards this. There will most likely be several different UIs for this service that will installed later on, like custom widgets or UIs. The question is how to solve this in the most efficient way. Is it better to only use Intents for communication between UI and Service (sending control commands with Intents from the UI and listening for Intents from the Service for state and data updates) or should I prefer using IPC communication (AIDL -> Java Stub, binding to the service etc.)?

Since the UI might be started long after the service is started, I would either need to use sticky intents to signal current state, or have a very frequent intent sent by the service if choose to go with the Intent-based design. Which one would be the preferred way in that case? I've read that sticky intents are much more resource consuming than normal intents, but are intents more consuming than IPC directly towards the service? Also, is really an AIDL the right way to allow third-party integration? Intents sounds better, since they are also asynchronous.

View 12 Replies View Related

Android :: Efficient Way Of Updating UI From Service Than Intents?

Apr 12, 2010

I currently have a Service in Android that is a sample VOIP client so it listens out for SIP messages and if it recieves one it starts up an Activity screen with UI components. Then the following SIP messages determine what the Activity is to display on the screen.
For example if its an incoming call it will display Answer or Reject or an outgoing call it will show a dialling screen. At the minute I use Intents to let the Activity know what state it should display. An example is as follows:

Intent i = new Intent();
i.setAction(SIPEngine.SIP_TRYING_INTENT);
i.putExtra("com.net.INCOMING", true);
sendBroadcast(i);
Intent x = new Intent();
x.setAction(CallManager.SIP_INCOMING_CALL_INTENT);
sendBroadcast(x);
Log.d("INTENT SENT", "INTENT SENT INCOMING CALL AFTER PROCESSINVITE");

So the activity will have a broadcast reciever registered for these intents and will switch its state according to the last intent it received...............

View 2 Replies View Related

Android : How To Call Service By Intents / Programmatically?

Nov 1, 2009

I'm rather new to Android, so please bear with me. I'm developing an application running a service in the background. The service is ONLY supposed to run when requested somewhere in the UI. The service must be able to be stopped through the UI as well. At the same time, while running, the service must be able to pick up intents such as "intent.action.DATA_SMS_RECEIVED" and "intent.action.NEW_OUTGOING_CALL".

View 2 Replies View Related

Android :: Intents In Queue - Send Data Via Web Service

Sep 29, 2010

Is it possible, with an IntentService, to send another intent to the IntentService from within the IntentService? For example, say my IntentService is processing an Intent which has it write a bunch of data to the database. During this time, several other Intents to write other data may [or may not] have been queued up in the IntentService. Suppose, after processing that Intent by writing the data to the application's database, I want to queue up another Intent to send that data via web service to "the cloud." Perhaps I want to queue this processing in another Intent because sending to the cloud is secondary. Is it possible? Would it cause any problems if the Intent being processed is the only Intent in the queue at the time the IntentService is trying to queue another Intent?

View 2 Replies View Related

Android :: Use Of Intents Used For Sending Data To Activity From Service

Feb 16, 2010

I am little confused with the use of intents used for sending data to activity from service. In my application I have to have startactivity from the service and have to pass data ,so that activity can utilize the data while launching.For this i have written the following code Intent intent = new Intent(Service.this,Activity.class); intent.putExtra("data", data); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.start Activity(); I assume that the data is passed to the activity and can be parsed on the oncreate function of the activity.Now the service running in the background has to pass data to the activity continously for UI updates.For this I have written the following codeIntent intent = new Intent(Service.this, Activity.class); intent.putExtra("Data", data); intent.setAction(Intent.ACTION_ATTACH_DATA); sendBroadcast(intent,null); (Do I need to broadcast the intent???) In activity I have done following things:- Implemented broadcast reciever:private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_ATTACH_DATA.equals(intent.getAction())) { Bundle extra = intent.getExtras(); float Data[] = extra.getFloatArray("Data"); update(Data);

View 4 Replies View Related

Android :: Sending Intents From Receiver To Service With Delay

Aug 18, 2010

I have a Receiver for BOOT_COMPLETED intent and it will start a Service by calling startService with an intent and the Service processes that intent in onStartCommand function by spawning a thread that does a HTTP post to a server.On powerup, sometimes it takes 3 to 5 seconds to get the active data connection on phone, when this happens Service fails to do HTTP post as there is no data connection. Is it possible for the Receiver to send the intent to Service using startService with a delay.? so that when onStartCommand of Service is called data connection is ready to post data.

View 2 Replies View Related

Android :: Passing Intents From Service To New Launch From Main Activity

Mar 30, 2009

How do you pass an intent from a service to a new activity launched from a main activity? There's a passextra( intent src ); but I don't think thats what I am looking for?

activity main > start service( intent wuteverserviceintent );
activity main > start activity( intent newactivityintent );

View 2 Replies View Related

Android :: Unable To Get Data From Activity To Service / How Intents Could Pass That?

Nov 24, 2010

I am pretty new to this but I was told I could get good help here. A friend and myself are playing around with creating Android apps (using ADT)

Here is how we are trying to make the program: in activity, user sets threshold values for the X and Y axis on accelerometer. When user hits button "Start", startService is invoked and starts TiltService.

TiltService is designed to run in the background always on the phone without user interaction. TiltService constantly compares the threshold with the accelerometer values and will vibrate if they are off.

My problem is I can't seem to get the putExtra() data correctly. I have overridden the onStartCommand in my service but I get the message "unreachable code" when I save the getExtras() to a bundle.

Here is the relevant code (I can post the whole thing, just do not want to clog up page) code...

I thought I understood the basic of how Intents could pass data, but I guess I don't. Is it obvious what I am missing?

View 2 Replies View Related

Android :: Service Restarted With All Unfinished Intents That Returned Start Status START_REDELIVER_INTENT?

Nov 1, 2010

Suppose you have a download service that downloads files asynchronously. For each download intent received it will put the URL of the file to download and the start ID into a job queue and return START_REDELIVER_INTENT. A worker thread then processes that list and calls stopSelf with the start ID it just processed. My question is: If the service's process gets killed and the service restarted, will the service receive all the intents (with the URLs) it hasn't called stopSelf on before it was killed or does the service receive the last intent only? It seems the API docs are ambiguous on this.

The docs say

"if this service's process is killed while it is started [...], then it will be scheduled for a restart and the last delivered Intent re- delivered to it again [...]", indicating that only the last intent gets redelivered (which would be terrible in this use case), but they also say "The service will [...] be re-started if it is not finished processing all Intents sent to it (and any such pending events will be delivered at the point of restart)."

View 4 Replies View Related

Android :: How To Have Android Service Communicate With Activity?

Mar 17, 2010

I'm writing my first Android application and trying to get my head around communication between services and activities. I have a Service that will run in the background and do some gps and time based logging. I will have an Activity that will be used to start and stop the Service.So first, I need to be able to figure out if the Service is running when the Activity is started. There are some other questions here about that, so I think I can figure that out (but feel free to offer advice).My real problem: if the Activity is running and the Service is started, I need a way for the Service to send messages to the Activity. Simple Strings and integers at this point - status messages mostly. The messages will not happen regularly, so I don't think polling the service is a good way to go if there is another way. I only want this communication when the Activity has been started by the user - I don't want to start the Activity from the Service. In other words, if you start the Activity and the Service is running, you will see some status messages in the Activity UI when something interesting happens. If you don't start the Activity, you will not see these messages (they're not that interesting).

It seems like I should be able to determine if the Service is running, and if so, add the Activity as a listener. Then remove the Activity as a listener when the Activity pauses or stops. Is that actually possible? The only way I can figure out to do it is to have the Activity implement Parcelable and build an AIDL file so I can pass it through the Service's remote interface. That seems like overkill though, and I have no idea how the Activity should implement writeToParcel() / readFromParcel().Is there an easier or better way? Thanks for any help.

View 2 Replies View Related

Android :: Possible Bug With Intents / Pending Intents

Nov 7, 2009

I have some code that is creating and removing alarms, and which works great in Android 1.5 and 1.6 but breaks on the Android 2.0 AVD.The code that's giving this exception is: Code...

View 3 Replies View Related

Android :: Downloading Applications - Death Of At&t Service?

May 28, 2010

I have been a Iphone guy for a while but I am just sick to death of At&t's service. I was just wondering can you download these apps right to your phone or do you have to download to a computer 1st and can you download them to your Apple Laptop?

View 1 Replies View Related

Android :: Access Service Across Multiple Applications

Apr 19, 2010

I have a service that i need to access across multiple Applications. Can anyone tell me how this can be done?

View 6 Replies View Related

Android :: Multiple Applications Using Single Service

Jan 14, 2010

I have to write an application which starts a service. There will be other applications which have to use the service. Is it possible to write an application that only starts service and finishes with the service running?? How can i communicate from the different applications to the service? Is it possible to expose an interface from the service so that application can pass data to the service?

View 2 Replies View Related

Android :: Service To Monitor When Other Activates / Applications Start Or End?

Mar 10, 2010

Is it possible to make a service running in backgroud to be notified when an arbritary activity/application is started and ended by a user? I want to use it to log how often and for how long different applications are used in Android.

View 1 Replies View Related

Sprint HTC Hero :: No Service - Downloaded Applications Failed

Mar 18, 2010

My Hero is going haywire. I was trying to download some apps from the market today and they don't want to start. So I rebooted my phone to see if it made any difference. Now when it starts up I get error messages that the com.android.phone and a few others are not working and have to force a close. I have no service either. All the installed apps and components are working but not phone itself. I am with Cellular South in Mississippi and my wife has a Hero also which is working normally so I know it's not a network issue.

View 2 Replies View Related

Sprint HTC Hero :: No Service And Applications Force Closes

Apr 1, 2010

I just starting having this issue today. When I turn my phone on. I have no service and all my apps no not working and they have to be force close. My phone is not RAM Or ROM. I also tried to uninstall some apps.

View 5 Replies View Related

Sony Ericsson Xperia X10 :: Switching Service Provider Applications?

Oct 13, 2010

I purchased an unlocked new Sony Xperia X10 from overseas because I was told it wasn't going to be released in the US. I had been waiting for the release since I had heard about the production of the phone and so I didn't care so much about the price. However, I recently went to an AT&T store and inadvertently saw my phone there and almost punched the first AT&T rep I saw for lying to me. I remained calm and asked if it was possible to get the AT&T software on my phone instead of the Telstra software applications that are non-functional and cannot be removed. They told me, "no, we dont do that, ask sony." Please, someone tell me I can somehow load the AT&T software to my phone, so I can use the applications that came with the phone, like MySync, Downloads, PlayNow, etc.. I spent so much money on this phone, and now it's available through AT&T for $150 with a 2 year contract; I wouldn't feel as terrible if mine could at least DO everything the AT&T one could.

View 8 Replies View Related







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