[Startup Task in not UWP Desktop App]

Ethiel Carmona Contalba 1 Reputation point
2022-11-04T16:02:43.287+00:00

Hi,

I was reading these two pages for Startup Task info

  1. https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.startuptask?view=winrt-22621
  2. https://blogs.windows.com/windowsdeveloper/2017/08/01/configure-app-start-log/

But is not clear to me what happen in apps that set the Enabled value to false for not UWP apps. I know with true the app is set to start automatically if the app was opened at least once.
I'm using electron-builder to build my app and it has the Enabled value set to true, Enabled="true", I have a weird case that I can't solve through code:

Pre-condition: We incorporate startup few builds after the first one released
If user has installed a version without the feature, uses the app and then updates to a version with this feature, the app is set to start automatically. This is annoy for users that have been using the app before the feature so we wont to set as electron-builder actually does. Through code after the update when the app is launched (by user or after reboot/shutdown automatically) we can set again the value to false
As you can see, the problem occurs between the update and the launch after the update. During that period of time we can't do anything to avoid that the app starts automatically after reboot/shutdown and I think its because of the Enabled="true"

In this post I'd like to know what should happen in that case IF the value was Enabled="false", could someone clarify this to me?

Inside the app I have a Config Dialog where the user can enable/disable the value, all of the cases are:

  1. For new installs, startup automatically is set to true (it works)
  2. For updates, it'll respect the user preference (it means that if the user didn't had the app to start automatically, we should respect the preference, but its not respected for the case that I post)

Do you know if these cases will be affected if we change Enabled="true" to Enabled="false"?

What I think Enabled="false" does is to allow the app (and user inside the app) handle the value instead of just set because of the manifest says that is true

Thanks!

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2022-11-07T07:14:56.687+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Do you know if these cases will be affected if we change Enabled="true" to Enabled="false"?

    I could just talk from the native UWP side about this. I've made a simple test about this. Just created a blank UWP project and added the extension in the manifest file with Enabled = false. When I restart the device, the UWP app will still restart. The document-UWP app startup task extension also mentioned that Enabled- For UWP apps, this attribute is ignored and the feature is implicitly disabled until the user first launches the app and the user confirms the app's request to enable activation at startup.

    The value to Enabled attribute in the manifest does not affect the start behavior. For UWP apps, user needs to confirm the app's startup request before this feature works. If user does not request this, the app will not be launched automatically. You could also disable this in the Startup tab in Task Manager.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments