Android :: AlarmManger Service Callback To Main Activity

Oct 30, 2010

In my application, there is a service which has a running thread to capture data from remote server, and also this service is triggered by AlarmManager, for example let 1:00 am to start the service. After the service finish the task, it stop itself and the main activity need to update GUI. I don't know how to let the main activity know when the the service stopped, so that the main thread can update GUI.

Android :: AlarmManger service callback to main activity


Android :: Service Callback To Activity

Jan 13, 2010

Our application will expose a Service that can be called by Activities in other people's applications.In many cases, the parent applications calling Activity may be paused before our Service completes. I am looking for the best way for a Service to communicate back to the calling Activity that may have been paused.These are the known options:

(1) Require calling Activities to have a registerReceiver() with a custom action and broadcast to that from our Service. The only way to secure this registerReceiver() is with a signature-based permission.As our Service communicates with any number of unknown 3rd party apps,we can't sign our Service's parent app with all these unknown certificates. These apps would therefore be exposing an unsecured registerReceiver() on their Activity. Would ideally like to avoid requiring this.

(2) Create a PendingIntent to send results back to the activity and give it to our Service. Our Service would send data to calling Activity's onActivityResult(). Each time the result is delivered, the calling Activity will go through onPause() and onResume() but this should be OK.

(3) The calling Activities could create a Handler. The Activity would then create a Messenger pointing to that Handler and send it to our service. Our Service can then use the Messenger to deliver our message back to the calling Activity.

View 2 Replies View Related

Android :: Service Updating Main Activity Gui

Aug 24, 2010

I have a service which collect data and send them to a certain URL and updating the main activity GUI, so which is better in the performance to use a long service with listeners to collect the data and threads in it to update the GUI and sends to the internet or to make another service responsible for updating the GUI and sending to the URL only while the first one just collects the data?

View 5 Replies View Related

Android :: Service Bound To Main Activity

Nov 11, 2010

so the application I've written has a service (that tracks GPS data) with a single main activity that binds to it with bindService in it's onStart() method, and unbinds from the service in it's onStop() method using unbindService( ServiceConnection ). I also have an activity which is an options screen, that is launched by pressing a button on the main activity. On this options screen, I have a checkbox that says "Run in background", which, if set to true, means that when the user exits the application with eier the Home or Back buttons, the service will continue running, not turning the GPS off. I do this by calling this.startForeground onUnbind, and this.stopForeground onRebind, if the setting is set to true, and stopping and starting my location reader onUnbind and onRebind respectively if the setting is false. If the service is running in the background, it also displays a notification to ensure the user understands that the GPS is still running and draining their power. This notification is displayed and stopped by relying on the startForeground and stopForeground methods......

View 1 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 :: Widget Starting Service Also Starts Main Activity

May 3, 2010

I have a widget that is supposed to start and stop a service (start it when it's not running, stop it when it is). This is working fine, however, each time the service is started, my app's main activity is also launched, which I don't want from the app's manifest, it works as I want it to (without launching the main-activity, just the service), but then I obviously don't have a main activity anymore.This is how I start the service (I would assume this is the normal way, and I can't see any reference to what might cause the MAIN intent to fire).

View 1 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 :: How Local Service Can Invoke A Sync Method On It's Main Activity?

May 2, 2010

I've configured local service under some app i wanna know how could i invoke methods on the activity, through the service in a synchronous way for example the service invoke a method inthe activity and waiting for for result(synchronous) from it.

View 2 Replies View Related

Android :: Network Service Need To Return Callback

Oct 6, 2010

if the service dies, and i know it can during request processing, it's an issue for me, first i've seen it, the process wont die until the net request returns (then the thread dies gracefully), unless kill -9 is used on the process... then i'm not sure what android does with the connections. I'm not sure what's the approach i should take here.(it will be true though even if this was a local thread and not a service)if i want the service to listen on a callback and call it once the network processing is done, i'm in a problem, no instances can be passed on using Intents.

So i need some other solutions, all the ones i though of sounds bad to me: A. use IBinder to get instance of the network service class then i can call one of it's methods and pass on an instance, this will work since they all run in the same process, BUT requires me to use Async way to get a Network instance which is not so suitable for me. B. Use static member in the Service i can access, then what to i need the service for ?. use intent to send parameters only to the service, the service will compose a Request out of it and put it in the queue, then once done will send a response using intent which will encapsulate the response (which might be long!) and will also contain the name of the calling class as a string so all the Receivers will know if it's for them or not - BIG overhead of encapsulating data in Intent and search in all the receivers for the right one to get the response.I don't want to use the service as a local running simple thread since i'm afraid if i'll run it in the root activity i will have to use static container so it will be visible in each activity and if the root will be destroyed for some reason it will take all the service with it, even if i start new task and the process is still alive.Anyone got some nice ideas on how to approach this thing ?

View 1 Replies View Related

Android :: How To Capture Browser Activity Or Callback

Sep 14, 2009

My activity calls a browser activity where the users submits their info to retrieve a PIN. That PIN is then sent as a parameter to a url specified in the request.

View 4 Replies View Related

Android :: Starting An Activity From Callback Class

Aug 18, 2010

I have an activity class(Application Class ) which calls a service class(Service Class) and closes. The service class takes about 5 seconds to complete its task and calls a method which is present in another class(Callback Class). Now according to the result, the callback needs to notify the Application class.Once i get the callback from the service, I tried calling a method defined in the Application class. In this method i create a new intent of Application class and call startActivity(Application Class). But this is not working. Can anyone tell where i am going wrong and what can I do to solve this issue.

View 5 Replies View Related

Android :: Callback To Activity After Layout Has Completed?

Jun 3, 2009

I want to find the dimensions of the various views in my layout. My understanding is this can only be done after layout is completed since layout is somewhat dynamic. So, after the activity calls setContentView() and then returns control on the main thread to the OS so that layout can occur, how do I get a notification that layout has completed so I that I can query the views for their dimensions? On a related topic, can I find out the status bar's height or least the screen's full size (from which the status bar's height can be calculate by subtracting my window's height)?

View 2 Replies View Related

Android :: Open Dialogue Activity Without Opening Main Activity Behind It

Jul 19, 2010

Im writing a program that offers a quick reply dialog upon receipt of an SMS.

However, I am getting an unexpected result. When I receieve an SMS, the appropriate dialog activity comes up displaying the correct phone number and message, however there is a second activity behind it that is the 'default' activity in my program (it is what opens when i launch my application)

I do not want this second activity to come up. The quick reply activity should come up by itself over top of whatever the user was doing before.

The 'floating' activity:

CODE:.........

The call to the activity inside an onReceive()

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

The Manifest:

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

View 1 Replies View Related

Android :: Passing Arguments From Loading Activity To Main Activity

May 16, 2010

I'm writing an application that starts with a loading activity. In the loading activity the app requests html from web and parses the html, then it sends the parsing result to the main activity. The main activity has several tabs, and contents of these tabs are based on the result of parsing.For example, the result of parsing is a list of strings ["apple", "banana", "orange"], and I need to pass this list to main activity, so that the main activity can create three tabs named after three fruits.I would like to know if there is any way to pass a list of strings among activities, BTW, is it the common way of do this?

View 2 Replies View Related

Android :: Start Activity When Main Activity Is Running In Background

Jan 10, 2010

I created an application which enables the user to set whether he wants to receive notification while the application runs in background mode. If the notifications are enabled an activity should be started (the dialog should appear on the screen).

I tried to enabled it the following way:

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

This is the method from main activity. When onPause() is executed isRunningInBackground is set true.
When I tried to debug it when the main application was running in the background the line

startActivity(intent) had no effect (the activity didn't appear).

Does anyone know how to midify the logic in order to start an activity from the main activity when the main activity is running in the background (after onPause() is called)?

View 1 Replies View Related

Android :: Starting Second Activity From Main Activity On Button Click

Dec 4, 2009

Need an example of how to create/start a new activity from the main activity. I have a button click event on the main layout. Originally I just used setContentView(R.layout.secondactivity); which brings up the layout but I don't think that is correct since the secondactivity class is not instantiated at this point yet. I have looked for such an example and can not find one.

View 3 Replies View Related

Android :: App Widget Configure Activity Opens Main Activity

Jan 10, 2010

I hav an app that is like a relational database. There is a main app activity that users manage things with. There is also a widget that will display important info and add data to the database. When the widget is clicked, a configure class displays a way for the user to edit data. When the configure activity is done, the widget is updated and instead of going back to the home screen, the apps main activity is started. I can't find where the main activity is being called from. Wouldn't I have to create an intent and start Activity() to get this behavior? When done updating, I want the home screen and not my app.

View 3 Replies View Related

Android :: Main Activity To Browser Activity Error

Nov 7, 2010

I have a main activity, then i call a new activity intent from this. Lets call this SecondActivity. Then from my secont activity i call a browser intent. Then my browser intent call my second activity's onNewIntent method.Evereything work fine, but when i click on "back" button on my phone on my second activity, i will not going to my main activity, but the browsers activity, why?

View 1 Replies View Related

Android :: Dialog Callback From Withing Callback?

Aug 28, 2009

I'm trying to pop up an AlertDialog when someone long presses a list item.What I end up with is nested callback objects.I'm not sure if that is the problem but simple Alert dialog examples are not working for me.

View 3 Replies View Related

Android :: Callback Before Force Close Of Android Activity?

Jul 22, 2010

I'd like to have some emergency cleanup code execute just before my app crashes. I tried using onDestroy(),, onFinal() and finalize() to no avail. Is this possible in an Android Activity?

View 2 Replies View Related

Android :: Getting An Asset Outside Of Main Activity

Nov 30, 2009

From digging around a bit, getAssets() is an inherited method from ContextWrapper. It returns an AssetManager, and using open() it can return an InputStream. What I'm attempting to do at this point, is use the GLSurfuceViewActivity, Cube and CubeRenderer to work and learn off of and read in vertex data from a binary file. I've already created the binary output by parsing a model obj file and added to the assets directory. My Shape class (modified from the Cube class) does not have access to calling getAssets() since it's not a subclass of Activity or ContextWrapper. Once I accepted that, I tried to think of the best way to read in the data (without storing it extra places) to the Shape class. What I did, and seems to be working okay, was modify the Shape and ShapeRenderer constructors to accept an AssetManger as a parameter.

View 3 Replies View Related

Android :: Application Without Main Activity?

Oct 5, 2010

Is there a way to manage application activities by hand, like this: user activating an application from menu, it does some initialization, then creates some activity (is it necessar y to declare all activities in the application manifest?), and listens to it's events. On some event application decides to close one activity and open another - so it contains all the application logic. Didn't found anything like this in examples, they all have all the logic in the activity classes. Maybe I need to user Services? (Maybe I don't understand right, what an activity represents. For me it's like window in windows, or Displayable in j2me) I'm very new to android development, trying to understand the basics.

View 4 Replies View Related

Android :: How To Tab In Activity To Display Main.xml?

Apr 6, 2010

I am trying to make a app with the tuotrail of the developerspage, then I would like to display a main.xml in a tabview, instead the textview, wich in the tuotrail,is in the activity.How do I tell my tab in activity do display the main.xml?

View 1 Replies View Related

Android :: How To Come Back Main Activity From Child One?

Mar 30, 2010

I'm in a small problem.i have three activities (suppose A,B,C) after performing onclick event in activity A, i can go to activity B and then C..my question is that is there any way to comeback activity A from C..here is the code snippet public void on Create(Bundle Code...

View 3 Replies View Related

Android :: What Is Recommend Way To Get Main Activity From Child One?

Mar 29, 2010

My android application has 1 main activity. And it launches some sub-activity (which I wrote) and that also launches some sub-activity (which I wrote). I do this. My question is how can each of my sub-activity and sub-sub-activity get back to the Parent activity? Code...

View 2 Replies View Related

Android :: Initialize Preferences From XML In Main Activity

May 20, 2010

My problem is that when I start application and user didn't open my PreferenceActivity so when I retrieve them don't get any default values defined in my preference.xml file. Code...

View 3 Replies View Related

Android :: Push New Instance Of Main Activity?

Sep 2, 2010

Is it possible to create/push-onto-stack a new Activity of the same main Activity in an Android application with an argument passed to the Activities constructor? Specifically from a Dialog object...

View 1 Replies View Related

Android :: Email App Switch Its 'main' Activity?

Dec 4, 2009

In android Email app, when I first launch it, it will shows me the 'account setup wizard' activity. But when I launch the Email app(after the account is set) again, it wont' show the 'account setup wizard' activity, it will show the 'Folder list activity ' instead.

How can it does the main activity switch (depends on the email account setup)?

View 2 Replies View Related

Android :: Call Main Activity From BroadcastReceiver?

Oct 28, 2010

While developing an alarm based application, i have stuck in a scenario.

When my alarm is fired, i can receive the event in BroadCastReceiver::onReceive().
Within this function, i want to notify/call a function, which is located on MainActivity.

How to achieve the same?

View 1 Replies View Related

Android : How Can I Change Main / Launch Activity?

Jul 13, 2010

I think I already know the answer to this, but I just wanted to confirm (I think no horrible ramifications)...

View 5 Replies View Related







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