Launch an activity from TileService for Android 14 is not allowed

291 views Asked by At

I have a simple TileService and try to launch an activity by click on the tile. It is works on Android 13 and low but in Android 14 I get an exception:

startActivityAndCollapse: Starting activity from TileService using an Intent is not allowed.

How to fix it?

1

There are 1 answers

0
zomega On BEST ANSWER

Here is the source code of TileService.java. And here is the documentation of startActivityAndCollapse(Intent intent).

Both say you have to use startActivityAndCollapse(PendingIntent) because startActivityAndCollapse(Intent intent) is deprecated.

You must be using startActivityAndCollapse(Intent intent) at the moment because you are getting this error. Use the other one instead.