Menu
  • HOME
  • TAGS

How to set speaker phone off when the app is killed by the “Recent App drawer”

android,android-audiomanager,ondestroy

Use a service like: public class FirstService extends Service { private AudioManager audioManager; @Override public IBinder onBind(Intent arg0) { return null; } @Override public void onDestroy() { super.onDestroy(); audioManager.setSpeakerphoneOn(false); //Turn of speaker } } public void onDestroy () Added in API level 1 Called by the system to notify a...

More than one principal activity

android,android-activity,root,oncreate,ondestroy

When you call your activity, you can try to take the running one and put it in the front with : intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); I recommend you to check your Manifest if there is something like : android:launchMode=["multiple" | "singleTop" ] It is also possible that your device run out of memory...

Is onDestroy called in an application when the phone runs out of battery?

android,shutdown,ondestroy,application-shutdown,system-shutdown

In reality there is no telling what will happen. There's even doubt about if onDestroy() will be called under normal circumstances. One of the few situations where onDestroy() in an Activity SHOULD be called is when using the BACK button or if an event in the Activity explicitly results in...

Android Fragment onCreateView after onDestroy not called again

android,fragment,lifecycle,ondestroy

After investigating some time i finally "solved" the problem by creating the view in onCreateView and destroy it in onDestroyView, without understanding why the system does not call the callback as described in the sdk documentation.

Android Alarm not triggered after finishing

android,alarm,ondestroy

Regarding the leak warning, you can define your receiver in your manifest like so <receiver android:enabled=["true" | "false"] android:exported=["true" | "false"] android:icon="drawable resource" android:label="string resource" android:name="string" android:permission="string" android:process="string" > . . . </receiver> this will give you the expected behavior. Reference here. An example: <receiver android:name="MyReceiver" > <intent-filter> <action android:name="com.doopy.numbers.ACTION_PLAYREMINDER_DAILY"...

Can we have blocking waits in onDestroy()?

android,ondestroy

The onDestroy method (as well as all other activity lifecycle methods, view callback methods, etc.) is called on the application's main UI thread, so no, you shouldn't block for a significant period of time when called. Doing so will likely result in lag, and may even spawn an ANR (application...

Android initializatoin of class fields not done

java,android,initialization,ondestroy

Statics are statics -- they are global to the process. So their value will last for the lifetime of the process, which is usually much longer than an individual activity instance. Source: https://groups.google.com/forum/#!topic/android-developers/PZXbCXliRbo...

Android onStop onDestroy called after onCreate

android,ondestroy

You're calling setRequestedOrientation to landscape as soon as you start your Activity (onCreate). The documentation states Change the desired orientation of this activity. If the activity is currently in the foreground or otherwise impacting the screen orientation, the screen will immediately be changed (possibly causing the activity to be restarted)....

Registering “onDestroy event handler” with Android Activity

android,android-activity,ondestroy,eventhandler

You can make your library class implement Application.ActivityLifecycleCallbacks and then register it using getApplication().registerActivityLifecycleCallbacks(libraryClass); Then your library class will receive all activity lifecycle callbacks from your application. If you're only looking for one activity's lifecycle events, the ActivityLifeCycleCallbacks methods have Activity parameters and you can filter for the activity you're...

Android - destroying service on calling stopService

android,service,ondestroy

From the docs: Once requested to stop with stopSelf() or stopService(), the system destroys the service as soon as possible. However, if your service handles multiple requests to onStartCommand() concurrently, then you shouldn't stop the service when you're done processing a start request, because you might have since received a...

Scope not being removed

angularjs,controller,angularjs-scope,ondestroy

The short answer is, $destroy is not automatically called by Angular when an element is removed. You must call it explicitly (https://docs.angularjs.org/api/ng/type/$rootScope.Scope): $destroy() must be called on a scope when it is desired for the scope and its child scopes to be permanently detached from the parent and thus stop...