The state of the Android system

There is a problem, for example, when you are using Googlemap to navigate and an AD pops up. This behavior can actually cause a lot of confusion to users, who may uninstall the application.

We also received some feedback from users on Googleplay, including one who reported missing a child’s important moment (graduation or child’s birthday) when a pop-up AD popped up.

So in Android Q, we added a new restriction: Apps can only start activities when they have a visible window or in response to user actions.

As you can see, now when we’re navigating, if another app tries to start the Activity, we display a “toast” to remind the developer that his app can’t start the Activity in the background and needs to change the app as soon as possible.

Nine conditions allow an Activity Starts

Developers must ask: When can you start the Activity? What are the conditions?

We have summarized nine main conditions in the official documentation:

1. The application has a visible window, such as an Activity in the foreground

In other words, your app is what users are using. However, it is important to note that the foreground service does not equate to the application being in the foreground when the Activity is started.

2. The application has an activity in the foreground Task stack

For example, in the figure above, the activity Y is not foreground for the time being, but it still can start a new activity when the foreground activity starts.

3. The visible application is bound to the application’s service

For example, if your app provides an SDK for a visible third-party developer, and the SDK is tied to your app’s service, your app can actually start the activity in the background.

4. The visible application sends a pending Intent for the program

For example, if your app provides an SDK for third-party developers and a visible app sends a pending intent to your SDK, you can also start an activity.

One caveat: If you send a broadcast or pending intent for a service, you only have a few seconds to start the activity before it starts.

5. The system sends a pending intent for the application

case situation Whether to allow
1 The application launches the UI from the notification click allow
2 Use AlarmManager to schedule alarms to send pending Intents to start the activity Don’t allow

6. The system sends broadcast to the application program

This scenario also needs to be categorized:

case situation Whether to allow
1 Your application has a broadcast receiver that accepts NEW_OUTGOING_CALL allow
2 Your application has a broadcast receiver that accepts BOOT_COMPLETED Don’t allow

Note that in case 1, NEW_OUTGOING_CALL intent is broadcast before Q starts.

We added a relatively new API to Android Q called the Call Redirection Service. If your app is used to accept incoming calls or handle incoming calls, We will recommend calling the new APIs starting with version Q.

7. Services bound to applications by the system

case situation Whether to allow
1 Your application provides an implementation of the Autofill Service allow
2 You use JobScheduler to schedule work. When the system is bound to your JobServicfe, you want the application to start the activity Don’t allow

8. The application is associated with the companion hardware device through the self-expressive devicemanager APIs

For example, if your app has Wear OS by Google support, it can respond to user actions on paired devices. For example, if the user does some action on his watch, the Companion APP will pop up a UI that allows the activity to start in that scenario.

9. The application is a Device Policy Controller running in Device Owner mode

Have you been affected?

We hope developers will pay attention to these areas as soon as possible:

  • Do you currently start your Activity from the background?
  • Your code base
  • In Q Beta 3, the previous version was enabled in license mode, which means the activity can still be started, but you’ll see a toast like this: Backgroud activity start from som.google.android.dailer blocked.Seeg.co/dev/bgblock.

Applications to be migrated

1. Call processing and alarm applications may be affected (for example, setting an alarm requires starting the UI of an alarm clock)

2. The application authenticates logins across devices

3. The activity application restarts automatically when a crash is detected in the background

Mitigation strategy

There is a sentence in our official documents:

In most scenarios, the application can provide the user with information via notification, allowing the user to decide whether to launch the UI or not. For example, for time-sensitive events, you can create a high-priority notification via the Notification APIs and set the appropriate category for the notification. One important thing to note is that in notification, if you want it to be a FULLscreen UI, I would recommend putting a setFullScreenIntent in it.

Of course, if the user is using his phone, the system will use a hands-on notification to remind the user of the notification instead.

Advantages of the Notification APIs

1. The biggest advantage is that it does not disturb the user and allows the user to maintain its context.

2. After the device locks, set a full intent to display a full-screen UI.

3. If the user chooses the “Do Not Disturb” mode and you display it through the Notification APIs, you will comply with the desired state without changing any code

4. Notification Settings provide more transparency and control. We made a lot of optimizations, like adding notification Channel.

Finally, we want all developers to respect what users are paying attention to and leave their APIs alone.

Android Q Beta

For testing, in Q Beta1 we use a mode called license, so you can see toast in Beta1 and Beta2, but not after Beta3, but we still have a setting that temporarily disables it. It’s called Allow background activity starts. If you have this feature on, your app can temporarily start the activity from the background, but we only recommend using it for adaptation.

If you want more detailed documentation, please visit this website:

Android Q Labs live features page

Android Q Labs opening speech

What are the updates to Android Q

Android Q modernizes your application

Android Q partitioned storage

Android Q gesture navigation

Jetpack update

Android Q adaption for foldable devices

Introduction to common system images

Google Play Store policy

Android Q location permission changed

Android Q has a dark theme

Android Q Labs concludes the presentation