-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android 14 requires a foreground service type for startForeground #24
Comments
Thank you for the heads up. Fixed in 0.4.9! I did set it to android:foregroundServiceType="specialUse". Let's see if Google has any issues with that! |
@joaomgcd See https://developer.android.com/about/versions/14/changes/fgs-types-required#special-use we are supposed to also add the property and this will all go through a google form very soon :( If this road is chosen then the value should be well defined and we should already prepare a talk to convince Google, this will be a nightmare as each and every time :( |
You can override the service declaration in your manifest with your own description and the manifest merger will merge it. The important thing in this fix was the code. |
I perfectly know that, but you missed the important part: Google Form to publish in Play Store in a couple of months or less depending on their decisions. If all apps puts random things there it will be harder to have a common ground discussion with Google so that they accept the permission and not reject your app and you'll be wondering what to do in that case. The specialUse case is for certain one that will be under the form and will be the harder to get validated by the dumb support team. |
I don't read it as that. I read it as it's a freeform field to put your use for it, like how it is in the various forms on the Play Console. I think having a shared one would actually be detrimental as they'd view it as either spam or potentially malicious if everyone submitted the same generic "This is for Tasker" reason. |
The use is the same for everyone as it's the same library and the same service name. I suppose you never had to deal with Google support for permission forms and the joy it is. At 99,99% the answer will be rejected, we can not confirm that this is a core feature of your application. The reviewer barely speak English and everything needs to be very simple sentences. Try to explain this is to allow automation from another app named tasker. |
I regularly deal with Google's policy team, in fact I spent much of last week arguing with them to turn on a VPN because they indeed do not read what is in front of them. This was for an app with 1.2 million users and was blocking an important update - they are useless. However, I reiterate, I do not think sending the same message from multiple apps to them is a very good idea. Their ideas of "spam" are very rudimentary, and I'm pretty confident this would fall under them. The use is not the same for everyone, plugins do not all do the same thing. For example, the plugin at the root of this thread is for allowing Tasker to update and modify components of my app to effect what is displayed in a widget - it's not just "Allows Tasker to work with my app". They are more likely to approve an app-specific description than one they've seen before from another app. |
Well I'll let you discover then when they tell you that you do not need a foreground service for that. Tasker is foreground if it binds to our service for your need you do not need to go foreground. To update widget they will tell you work manager that is made for this. The concept of other app calling your app won't matter. That's why yes it matters to explain why tasker needs to start a foreground service to communicate with our app even if in most case it actually don't. |
You've essentially just proven my point. If I were to use a generic message, they would indeed ask why I need a foreground service to update a widget. That is why it should be custom, so you can provide a explanation of why it is needed. Just saying "oh it works with this app called Tasker" would most likely just be rejected, whereas a detailed message about what the Tasker integration provides and why a separate service is needed would be far, far better. Anyway, since we're never going to reach an agreement on this, how about as a compromise there could be a generic reason in the library, with a strong emphasis of overriding it with your own. If you want to run the risk of using a generic message, that's on you. But when in a year they blanket ban every app with the generic message because it's deemed "spam" or because one of them was doing something deemed malicious and therefore they're all connected, don't say you weren't warned. |
I'll remove the plugin and tell user to call my API instead. And the explanation will be on the form that you fill not in the 20 char you'll use there. Future will tell but 12 years on Play Store touching with many perm form we already know it will be a shit show. They want the end of foreground services. |
The developer page specifically asks for the explanation to be in the manifest, and asks you to provide enough information in it alone - putting a brief explanation in here and expecting them to read the form will probably not go well I agree the service name will stay the same - it will have to - but the use case does not need to. And yes, they are doing everything they can to kill off foreground services. The Play Store is minefield to submit to nowadays, which is why I no longer submit personal projects due to the risk of their stupid "association" bans impacting my work, because one test phone was on the same IP once or something ridiculous like that. It's bad enough having to communicate with the policy team for large apps, let alone small ones. |
Again there is no need for the service to be foreground for 99% of the cases. So either we can have a default communication or most people will be rejected. Tasker is foreground if it binds to our service we are foreground too. So the actual real solution is to fix the API to not require foreground when not needed, not hoping that everyone will be able to pass a dumb review system handled by monkeys. This will be frustration for the whole Tasker eco system with no benefits. |
Sorry for the late Response. @Tolriq foreground services are required if the actions done in the service take more than 5 seconds to complete. Unfortunately you can't really control how much time your service will take because sometimes users' devices are slow and will take a long time to perform even trivial operations. Because of this I thought it would be appropriate to make foreground services a requirement? What do you think? Also, ( also for @KieronQuinn ) just thinking here: since not all plugins require actions or conditions (a plugin could only have an action or a condition and not both) I shouldn't declare the services at all in the plugin library's manifest, right? Because if I do, plugin developers will have to justify services that they don't even use. Am I thinking correctly? |
@joaomgcd I don't know Tasker internals but since tasker is foreground it can just bind to the service and do not have any limitation in times. The 5 second limit for a service is the time to go foreground if you call startforeground else it ANR. But this is another story since you can bind and not call startForeground at all. (https://developer.android.com/guide/components/foreground-services#background-start-restriction-exemptions) For the other question, yes if there's things that does not require the foreground services at all clients should not be forced to deal with the stupid Google review team. One way could be to split the library in 2 parts so that it's clear what requires it (if it really requires) and what does not. But really the question is are the services really needing the foreground here? I'm pretty sure we can solve this without foreground at all. |
Hhmm, switching to binding services from what we have now is kind of a big refactor. 😅 I would also have to do plenty of tests with it because I don't have much experience with binding services myself... Thanks for the suggestion. I'll look into it. |
You are not forced to go full bind and aidl :) You can just cheat the system. You bind to the service without anything special or calls to the service (just a service connection to manage) and you keep doing what you do without calling startForeground, just a normal start. The only question would be if OEMs have broken implementations that does not propagate the foreground state, but we already have to deal with OEMs that do not respect foreground at all so in the end it would not change a lot. |
I see what you mean. Ok, let me try that and see how it works. Thanks! |
So, first shot at this. If you could try building the plugin library from source (get the latest version) and then make hasToRunServicesInForeground always return false and then try using this version of Tasker and see if it correctly runs your actions with the bound service but without putting it in the foreground... Can you try that? 😅 Thanks in advance! |
I can try tomorrow but I'm not an advanced Tasker user. So not sure I'll be able to test all. A part of the plugin export state I don't even know how to properly use it on Tasker :p |
It's really just a matter of adding a Yatse plugin action in a task and running it and see if it runs correctly :) If nothing crashes and it runs as expected (after you did the change to the code I mentioned above), then it means that Tasker is running the plugin correctly without asking it to be in the foreground. Let me know if you have any questions! |
@joaomgcd So tested with the hasToRunServicesInForeground to false and removing the FGS type from manifest to be sure and it does not crash and the simple commands like playpause works properly. Not sure this counts as a full test, but this works in Android 14 :) |
Sounds good :) And your app is already targeting Android 14, correct? |
Yes and it crashed before I added the fgs types. |
Cool! Ok, I'll try a release with this change then. Thanks for testing! |
It will probably require some coordination between the lib and tasker to ensure no issue. If the library is updated to remove the fgs type we need to check that tasker is up to date or find a way to warn the users to update tasker. |
Yep.
The problem is that the current public version of Tasker doesn't have this check yet, so I'll have to hurry and update it as soon as possible 😅 |
What I meant is if I update Yatse with a new lib that have the tag and no more FGS type. |
If
Tasker will always call plugin service in the foreground and plugin will always call startForeground in its service. Oh, but you're right, the service does need to retain the FGS type tag :/, because it would crash if it runs with an old Tasker version. But if the FGS tag is retained we end up where we started with the Play Store issues :/ Hmm... do you see any solution for this? |
If tasker always startforeground calls and it's not the plugin doing something then there's not much. Only solution is to add a way to check tasker version in the library, keep the FGS type for now until Google add the form. And during the intermediary time the apps can check if tasker is uptodate or not in the calls and tell the user that he should update. Not perfect but well. |
Lol no problem we still have time, but in all case for tasker showing them a video of another app would be problematic anyway :) |
So the dead line is now official it's 7th December to be approved or no more updates allowed :( Have you made progress with Google and that other permission? |
I'm working on the release now. The problem is that I now need to update the app on all tracks without the permission, so I can't widely test the new version that doesn't have the permission. I'm hoping to do a public release next week though! It's so weird how they demand that you update all release tracks at once without the permission and don't even allow you to beta test it :( |
One of the many Google mysteries :( But I'm sure we'll face the same issue with tasker plugins won't be able to test a release without the perm in beta without getting the form first. So absurd. |
Ok, I've sent the app for review now in Production. Hope they approve it soon. |
@joaomgcd any luck with the publishing? Deadline is short now. |
Just saw your post on reddit :( So sorry, Google is really a pain those days this is incredible :( @KieronQuinn did you attempt the form with the custom permission did they validate it? |
I don't publish on Google Play, for this very reason. |
Yeah, sorry, they keep making stuff up and I can't really understand why. Now they're saying I'm sending SMS and Contact data to http://myserver.com/ .... And worst of all, they're taking a really long time to get back to me about it after I asked for proof. Sorry! :( |
Don't be sorry this is not your fault if Google is becoming more and more hostile to indie devs :( We just need to adapt with the little info we have. |
@joaomgcd don't know why can't post the patch file on reddit. You probably forget to change something. Here's the Yatse patch that pleased them .
|
Thank you very much! I actually did all of that :/ They actually got back to me now again and added a small piece of information: Note that the production APK of your app must be compliant with our policy. So, that means that, once again, I have to publish the updates I wanted to test directly to production... 🤷♂️ It seems like they are losing the grasp on what beta testing means... I've published it to production now, so lets see if they accept it this time. Maybe the whole problem was that they were looking at the production version all along... |
The joy of Wear / Android Auto review teams .... |
So now that Tasker is in prod I tried to go in prod too and they reject my DATA_SYNC permission saying me that I enter the wrong data without any details ... Anyway glad, you finally managed to publish :) |
Oh yeah, sorry that I forgot to mention it! And, what?? Why have the types if apps can't even use it :/ Geez... |
Yes it will be fun, good news is that it seems they give some time, after the appeal the update passed on "probation"
I seriously want to quit at this point too much pain :( |
BTW You should probably update the library now to no more embed the perm and stuff by default. |
Oh no, I just realized that I need to do this change for the conditions service as well! 😨 Oops! Well, at least you can still update your app to use the I'll try making the same change to the Condition Service too. Sorry for the hassle. |
Hum I went to prod with last library version and override all the perms / FGS part. No complain so far so I guess it kinda works. Can't push more updates now they really want me to fix that form and i'm waiting for details about why clicking a by download button is not an user initiated action for them ..... |
@joaomgcd seems you never updated the condition service and it crashes for some users without the FGS type.
Does the tasker side support it and it's just adding the fix in the library side or not ? |
@joaomgcd Well yes we discussed about users being able to remove the specialUse to avoid the pain of Google form reviews. As you know Google reviews are a pain, and avoiding the form via the binds is a life saver :) Already too much pain to deal with like their new PHOTO/VIDEO form ... |
Oh, oops! I totally forgot about that 😅Sorry! I haven't implemented the binding in the condition service yet. Does Yatse have any Tasker conditions? BTW, I actually just put an app in production with the speacialUse permission (again, forgot about the binding thing :P), and Google actually allowed it, with no back and forth at all. The app is AutoSheets and I simply justified it like this: For example, a user might want to log each time they connect to a wifi network in a Google Spreadsheet, and that would have to happen immediately after the user connects to a wifi network and must complete right away (so it can't be paused) so that the rest of the task can run normally.** |
Yes Yatse have conditions and it crashes currently on Android 14 :) And since Yatse have Android Auto, Wear and many advanced things that the reviewer have issues with, every review now nearly take a week for a simple update. So not having to deal with one more form that will makes each review a little more risky on each of their change of mind is better. |
Thanks. Just to clarify, those conditions are events, correct? |
Yes I push the states, not really sure how they are used by users. |
Ok, I've made the change now. First, you have to do 2 changes to the plugin code (I'll change it myself for everyone once this Tasker version is publicly available): In the manifest change this:
to this
Of course, you can also remove the relevant permissions at the top. Then in the ConditionReceivers.kt file change this
to this
Then can you please try this version of Tasker and then trigger one of your events in Tasker and see if you no longer get the crash? Hope this helps and again, sorry for the trouble! |
No trouble here, it's all Google fault :p I'll try to test soon, but probably next week now :( |
👍 |
As of Android 14, all foreground services need a type.
Currently, when targeting 14, you get this exception when running a plugin:
Note that the services declared in the manifest must also have this type, I suggest maybe the special use one might be best. Unsure how this would be taken in Play review though.
The text was updated successfully, but these errors were encountered: