Edson LC.
Edson LC.

Reputation: 25

My app dies when switch to another app

I am developing two apps:

-> App A: it connects to a Bluetooth device, retrieve some data, process this data and broadcast an intent to App B

-> App B: it receives this intent and shows the results.

App A must keep running in order to keep sending data to App B.

Everything was working fine until this week when I made some visual changes and update my android device to V7.0.

Now, My App A stops (DEAD message in debugging window in android studio) when I switch to App B and see the results. If I change back to App A, current activity restarts itself and it works normally once again.

I do not get any exception or error message in android studio's debug window.

Any idea or information about this issue. I must say I have read a lot of questions and documentation but I can not find the reason of this issue.

(sorry for bad English)

Upvotes: 0

Views: 778

Answers (1)

dominicoder
dominicoder

Reputation: 10165

Everything was working fine until this week when I made some visual changes and update my android device to V7.0.

7.0 has introduced numerous changes aimed at improving battery life. Your App A is likely suffering from these changes, particularly if it was memory / cpu intensive, which it sounds like it might be.

App A must keep running in order to keep sending data to App B.

If that's the case, you probably want a make App A a foreground Service to ensure it keeps running.

Architecturally this probably makes more sense anyway if your use case is to have App B open while App A keeps piping data to it. The fact that your App A was not dying before was likely just lucky chance. It would have been killed by the system eventually after going into the background.

Upvotes: 1

Related Questions