Android :: Stopping And Starting Service Based On Application State

Oct 28, 2010

I have a Service which tracks the location of the user. Currently, the Service boots when the application starts and stops when the application terminates. Unfortunately, if users keep the application in the background, the Service never stops and drains battery.

I would like the Service to stop when my application is not in the foreground. I was hoping the Application class would let me Override onPause and onResume handlers, but it does not have them.

Android :: Stopping and starting Service based on application state


Android :: Changing Displayed State Of Views Based On Parent ViewGroup's State

Aug 11, 2010

I have a compound UI component built up from a ViewGroup containing a number of TextView, ImageView etc. components. Many of these have StateListDrawables as their images/backgrounds. Is there any way of making them select from this drawable based on the state of the parent ViewGroup rather than the component itself? Ideally I want to be able to change the visual state of all children of the ViewGroup (text colour, image etc) based on the state of the ViewGroup, preferably without having to hook up complex logical code. This seems like a fairly common sort of requirement, so I was hoping it would be straightforward in Android - am I going to be disappointed?

View 1 Replies View Related

Android :: Starting Class1 From Service Without Application?

Jul 2, 2010

I have a call blocking application. It has 3 files:
1) class BlockMyCall extends BroadcastReceiver
2) class SimpleClass1 extends Service
3) PhoneBlock extends Activity

I start "PhoneBlock " Activity to call Service "SimpleClass1 ", which eventually calls "BlockMyCall" intended to block outbound calls (by setting result to "null").

I want to know if I can run the class1 from service without starting activity. If so , how?

View 2 Replies View Related

Android :: Distributing Service-based Application On Market

Nov 22, 2010

We going to develop commercial application that will run on Android platform and now I'm thinking about distribution model.

Application itself will be of no use to regular Android user and will be installed only by people who know why they need it. Application will authenticate with server prior to launch.

We as a company will charge application users monthly fee and will track usage, etc via our servers.

So, I was wondering if there "locked" portion of market for this kind of stuff? Or, do I release app as a free one and if random people download it - they just won't be able to use it?

What is the best way to do that? Can I install application by giving users our URL?

I'm trying to make it as easy as possible.

View 2 Replies View Related

Android :: Starting And Stopping Services

Aug 14, 2010

I have a service running (Socket), this is how i start the service.

CODE:.......

But this doesn't seem to stop my service? Am i missing something? I need to destroy my service as soon as the home button is clicked.

View 1 Replies View Related

Android :: RotateAnimation - Stopping And Starting Again After Every Rotation

Mar 29, 2010

I am rotating a view using rotateAnimation with this code new RotateAnimation(0, 360, w / 2, h / 2); I want to rotate this view infinitely, so i put setRepeatCount(RotateAnimation.INFINITE);

But the problem is after every one complete rotation, its stopping and starting again, means by default rotateAnimation have AccelerateDecelerateInterpolator(). I feel because of this. So if i put setInterpolator(null), its throwing null pointer exception. How to solve this.

I want to rotate my view without any lag.

View 4 Replies View Related

Android :: Framework Support For Detecting Starting And Stopping Of Activities

May 13, 2009

To support usability studies on what applications are used, i want to write a service that logs when an activity is started and also when it has finished. This is to understand how the users are using the device:

One straightforward option is to have the applications modify, to write this out. But this is tedious having to modify all applications and will not work esp with third party or built in applications.

Is there any alternatives that makes this simpler and easier?

BTW: Looking at the android framework source ActivityManagerNative seems to be invoking a Binder interface when an Activity is started and finished. Any information on what this service is? Is this something i can tap into?

View 8 Replies View Related

Android :: Pausing / Stopping And Starting / Resuming Java TimerTask Continuously?

Jan 20, 2010

I have one simple question regarding Java TimerTask. How do I pause/resume two TimerTask tasks based on a certain condition? For example I have two timers that run between each other. When a certain condition has been met inside the task of first timer, the first timer stops and starts the second timer, and the same thing happens when a certain condition has been met inside the task of second timer.how do I pause timer1 while running timer2 and vice versa while timer2 is running? Performance and timing is my main concern as this needs to be implemented inside another running thread. By the way I am trying to implement these concurrent timers on Android.

View 4 Replies View Related

Android :: Lock Layer Error Intermittently When Stopping And Starting A Opengl SurfaceView

Jul 13, 2009

I'm writing a game using the drawing method from Chris Pruett's opengl spritemethodtest demo. The Activity running my opengl view works fine on initial load, and about half the time after turning off the phone and turning it back on. However, the other half, it locks up. I'll get a "lock_layer timed out (is the CPU pegged?)" warning that keeps repeating. I tried running the debugger to find the exact line that the error is occurring on, but the strange thing is that this error won't occur if I'm running the debugger on my G1. It only happens under normal operating conditions. Any help would be appreciated, as this bug really has me stumped.

Here are my onPause and onResume activity methods:

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

Here's a stack trace, running from the initial onCreate call to the lockup (I added some extra Log warnings to illustrate when different lifecycle methods are being called):

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

View 2 Replies View Related

General :: Stopping Unwanted Apps From Automatically Starting?

May 8, 2012

I have an Acer A100 tablet that I've upgraded to ICS (the upgrade went very smoothly, by the way). But under both ICS and the original Honeycomb, the Android OS has an annoying habit of starting a bunch of apps automatically. Facebook, Google Maps, media players and a whole host of apps that I do NOT want to start all by themselves. I found an "Advanced Task Manager" that will check every 5 minutes and kill unwanted apps automatically. But every time I check it there are still half a dozen apps running in the background that I don't want.

If it were just one or two apps, I would simply uninstall them. But it seems like half the factory apps are intent on restarting themselves no matter how many times they're turned off. My Acer has a very small battery, and I suspect I'd get much better battery life if it would only run the apps that I start manually.

Other than email and the system update manager, I really don't want any apps running in the background. And when I turn an app off, I want it to stay off until I restart it. Is there a way to edit the list of programs that start automatically? Do they all have to be disabled individually? I've checked a few of the apps, and don't see any way to disable the "automatic log-in", "check for new data" or whatever each program might call it's annoying insistence on starting whenever it wants to.

View 3 Replies View Related

Android :: Service Stopping Another Service

Feb 17, 2010

i have a question about Services in Android.I have a application with two Services A and B.Is it possible that Service A can stop Service B?I dont want to do it through a Activity, cause the Application will be in Background. If some special Event happen in Service A, then it should tell Service B to stop. How can i do that?

View 1 Replies View Related

Android :: Regarding Stopping Service

Jun 22, 2010

can someone help me.. i want my service to start as soon as the device starts and also the service to persis and remain started.it should destroy only when device switches off.

View 4 Replies View Related

Android :: Can An <selector> Be Based On An Object's Instead Of A View's State?

Aug 3, 2010

I think this is a pretty simple question but I'm having trouble finding the answer out there.I'm developing an android application (currently developing against v1.5 API) and one of the activities use a ListView. I want to be able to set the properties of each List Item based on the state of an in memory object rather than the state of the view or list item.Here is a simple example....say I have a Person class who's public members are defined as follows. Code...

View 1 Replies View Related

Android :: Stopping Other Activity From My Service..

May 6, 2010

I want to stop an Activity that is in some other application from my Applications service. Is there any mechanism to do so?

View 6 Replies View Related

Android :: Stopping Widget's Service When Not In Use

Jun 3, 2010

I'm having trouble getting my widget to stop hogging so many resources.I setRepeating on the AlarmManager to update. When the widget is deleted (onDisabled()), I call .cancel() on the service, but the service still shows up in the android "running processes" making me believe I'm doing something wrong.Also, should I be scheduling my updates in the onEnabled() or the onUpdate()? onUpdate doesn't seem to work on anything other than the first widget.

View 1 Replies View Related

Android :: Starting Location Tracking Based On GPS Number Of Satellites

Aug 23, 2010

How could I get and use the number of satellites before starting location tracking?For example I want to start location tracking only when there are min X satellites in use.

View 1 Replies View Related

Android :: Stopping A Service Once It Has Finished It's Work

Jun 30, 2010

I have an Android Service that is started by my application and does some things in a threadPool using Executors.newCachedThreadPool()

Once it has finished doing it's work I would like the service to stopSelf(), how can I get the service to determine when it is no longer needed (ie, there are no more Threads executing) so that it can shut itself down automatically?

View 1 Replies View Related

Android :: Getting And Stopping Single Running Service?

Sep 14, 2010

How can I identify and stop single running services? More specifically, once I got the running services on a List as in a chunk of code like:

ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); List<RunningServiceInfo> services = activityManager.getRunningServices(Integer.MAX_VALUE);

Is there any method to stop a single service, i.e to identify one and then stop it?

View 3 Replies View Related

General :: Galaxy S2 - Service State Says Out Of Service Or Radio Off

Jan 10, 2014

I have a galaxy s2 and after I installed costom roms I dont have any signal what so ever.

I tried with like 3 roms and the same result.

I tought it was a modem problem and I tried to install some modems and see if that works. But it didnt.

My Service State says Out of service and sometimes it says Radio off.

View 1 Replies View Related

General :: Simple Service Force Stopping Package?

Jul 17, 2012

OS: Ice Cream Sandwich
Device: Motorola Xoom

I am having issues with a simple service not running correctly. The logcat shows some force stopping on the installed apk. Also the broadcast receiver should listen to android.intent.action.ACTION_POWER_CONNECTED but it is not.

This all worked on froyo 2.2 on a samsung galaxy tab.

Here is the snippet from logcat when I do an 'adb install testService.apk:

Code:
D/AndroidRuntime(15251):
D/AndroidRuntime(15251): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(15251): CheckJNI is OFF
D/AndroidRuntime(15251): Calling main entry com.android.commands.pm.Pm
I/ActivityManager( 153): Start proc com.android.defcontainer for service

[code]....

View 1 Replies View Related

Android :: How To Get Service State?

Jan 6, 2010

I'm trying to get current service state of my phone. It can be easily fetched with get State() method of Service State when a on Service State Changed (Service State service State) callback is invoked: Code...

View 2 Replies View Related

Android :: Check The State Of A Local Service

Sep 30, 2010

How do I check whether the local service inside my application is running?

View 1 Replies View Related

Android : Way To Detect A Call State From A Service?

Oct 22, 2009

i have a service (that extends Service). public class MyService extends Service ..

View 2 Replies View Related

Android :: Starting Service In Separate Thread

Jul 27, 2009

i have a little frontend showing a list of items that it will retrieve from a service. I want that service to be started in a separate thread.so the UI is still responding to user interaction while waiting for that service to call a callback method. What is the best way to start the service in a detached thread?

View 6 Replies View Related

Android :: AlarmManager Starting Service - API Level

Nov 10, 2010

I've read comment that the AlarmManager in a earlier API version couldn't start services. Prior to which API Level was that?

I'am currently testing in the emulator with API Level 4 and it start a service just fine.

View 10 Replies View Related

Android :: Starting Activity From Service / Receiver?

Oct 27, 2009

I have a service that sometimes starts applications.The problem is: if the *previous app* (any app) was recently exited via the home key, then the following message appears in the log:ActivityManager: Activity start request from 10024 stopped.And there's then around a 5 second delay before the target app (any) is launched.If the previous app was exited with the back key, there's no problem.If the previous app exited more than a few second ago, no problem.The same also occurs with a broadcast receiver (which also requires the NEW_TASK intent flag to launch an activity).I don't know if the delay was there in 1.5, but I'm assuming not since I can't find the error message in the 1.5 source code.

View 5 Replies View Related

Android :: When To Use An Aidl Based Service?

Jul 26, 2010

Under what circumstances would using AIDL to define a service interface be the correct decision (rather than just creating an extension to the service class)?

View 2 Replies View Related

Android :: Notify Service From Phone State Listener

Mar 19, 2010

I have built an application that listen to call state changes, and I want to notify a service when the call_state became IDLE.All the components I have are functional, I just need to notify (not start) a service for this.What's the correct practice, maybe using AIDL? Because, in a PhoneStateListener, I can't bind to a service. Do I have to start an activity for that?

View 2 Replies View Related

Android :: Making Python Service To Run In Suspend State

Jan 16, 2010

Here's my Python script written using android-scripting:

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

while True:

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

It basically vibrates every minute (like a motivator). However, when the phone is locked with screen blanked out, I don't sense any vibration. Perhaps Android is freezing the script (and hence the while loop)? Note that I am indeed running this script as a service (long-tap and click 'Start as service').

Is there a way to make this script work all the time regardless of the phone suspend state?

Update 1: I do hear the vibration occasionally, not every minute .. but rather like every 5-10 minutes randomly.

Update 2: This problems occurs if I run the script normally (not as a service). Seems like "time.sleep" is not sleeping for the specified time.

View 4 Replies View Related

Android :: Possible To Get Music Player State For An Activity / A Service?

Aug 20, 2009

I wonder if it's possible to get music player state, like which is the current music playing, title, author and so on ? Better, is it possible for an activity (or a service) to be notified on music state changements (start playing, pause, etc.)

View 3 Replies View Related







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