I have an application which shows floating overlay windows and it works fine. It uses WindowManager.LayoutParams.TYPE_PHONE for the windows however and it says that it's deprecated on API level 26. Some people online said how they get errors when using TYPE_PHONE with Android 8.0 and up, but I've tested my app on phones with Android 9 and 10 and it works perfectly fine with TYPE_PHONE. Is there any benefit to changing it to TYPE_APPLICATION_OVERLAY for phones with 8.0 and up, since it works as it is? Target version is 25 currently.
Android overlay window on API 26+, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY vs TYPE_PHONE
Asked
Active
Viewed 1,145 times
0
-
See my question too. https://stackoverflow.com/q/76651691/4134215 – Taimoor Khan Jul 16 '23 at 20:10
1 Answers
0
As you can read in the official DOC (https://developer.android.com/reference/android/view/WindowManager.LayoutParams#TYPE_PHONE):
This constant was deprecated in API level 26. for non-system apps. Use TYPE_APPLICATION_OVERLAY instead
It doesn't mean that that value doesn't works, but only that is DEPRECATED. In newer Apps (targetting SDK >=26) you have to use the suggested value to be 100% compatible.
If you want to target up to 25 then you can continue to use TYPE_PHONE, but the Google Play Store doesn't more accepts Apps lower than SDK 29 ;)

emandt
- 2,547
- 2
- 16
- 20
-
Aw damn, well this app is on the play store actually, but it hasn't been taken down or anything, take that android api 26 and up. Anyway, thanks for answering – TwoheadedFetus Nov 27 '20 at 17:18
-
Starting from December (If I remember well) all new Apps or Updates should target SDK 29+ – emandt Nov 27 '20 at 17:43
-
actually it seems to already be the case, I just tried and couldn't update my app unless I updated the target version to 29 – TwoheadedFetus Nov 27 '20 at 18:18