Samsung “App optimisation” feature kills background applications after 3 days

I’ve owned (and currently own) Samsung devices, so I know a little as to how it works from the user’s point of view. The technical specifications and how it works on the inside is an entirely separate issue, and one I can’t answer. The system can detect if you open an app. Samsung uses that … Read more

Reasons that the passed Intent would be NULL in onStartCommand

I’m surprised there’s no discussion of the incoming flags. I’m going to monitor this in the logs with the following: if (null == intent || null == intent.getAction ()) { String source = null == intent ? “intent” : “action”; Log.e (TAG, source + ” was null, flags=” + flags + ” bits=” + Integer.toBinaryString … Read more

Restart the service even if app is force-stopped and Keep running service in background even after closing the app How?

I am not sure which ‘Task Manager’ you are referring to as different ones would act differently, so I am basing my answer on the action when the user goes to Settings–>manage Applications and–> force stops the app the way android has given him. Assuming that your service is running as part of the process … Read more

What is the difference between an IntentService and a Service? [duplicate]

Service is a base class of service implementation. Service runs on the application’s main thread which may reduce the application performance. Thus, IntentService, which is a direct subclass of Service is available to make things easier. The IntentService is used to perform a certain task in the background. Once done, the instance of IntentService terminates … Read more

Control the default music player of android or any other music player

AudioManager mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); if(mAudioManager.isMusicActive()) { Intent i = new Intent(SERVICECMD); i.putExtra(CMDNAME , CMDSTOP ); YourApplicationClass.this.sendBroadcast(i); } you can by getting the audiomanager then sending commands to it. these are the commands. public static final String CMDTOGGLEPAUSE = “togglepause”; public static final String CMDPAUSE = “pause”; public static final String CMDPREVIOUS = “previous”; public … Read more

How to monitor SIM state change

The Intent android.intent.action.SIM_STATE_CHANGED is broadcast when the SIM state changes. For example, on my HTC Desire with a T-Mobile SIM card, if I put the device into flight mode the following Intent is broadcast: Intent: android.intent.action.SIM_STATE_CHANGED with extras: ss = NOT_READY, reason = null If I then take it out of flight mode, the following … Read more