Alguns aplicativos do Metro (Universal) congelam o foco perdido?

2

Eu não sei se é possível consertar isso, mas eu adoraria saber; Descobri que alguns dos aplicativos universais (congelamento de doces é um exemplo) congelam quando perdem o foco. Eu queria saber se é possível mudar isso

Eu lembro que o aplicativo do Instagram fez isso em um momento no passado e foi bastante frustrante, pois eu estava tentando assistir a uma transmissão ao vivo, ele simplesmente parava de tocar quando ficava fora de foco.

    
por Peachy 19.04.2018 / 10:30

1 resposta

1

Os aplicativos da Loja têm um ciclo de vida mais complexo do que os aplicativos Win32 :

Before Windows 8, apps had a simple lifecycle. Win32 and .NET apps are either running or not running. When a user minimizes them, or switches away from them, they continue to run. This was fine until portable devices and power management became increasingly important.

Windows 8 introduced a new application model with UWP apps. At a high level, a new suspended state was added. A UWP app is suspended shortly after the user minimizes it or switches to another app. This means that the app's threads are stopped and the app is left in memory unless the operating system needs to reclaim resources. When the user switches back to the app, it can be quickly restored to a running state. By default, apps that are not in the foreground are suspended which results in power savings and more resources available for the app currently in the foreground.

The suspended state adds new requirements for you as a developer because the operating system may elect to terminate a suspended app in order to free up resources. The terminated app will still appear in the task bar. When the user click on it, the app must restore the state that it was in before it was terminated because the user will not be aware that the system closed the app. They will think that it has been waiting in the background while they were doing other things and will expect it to be in the same state it was in when they left it. In this topic we will look at how to accomplish that.

Paracontinuarotrabalho,osaplicativosdevemoferecersuporteatarefasemsegundoplano:

Therearevariouswaysforappsthatneedtocontinuetorunwhentheyareinthebackgroundsuchasbackgroundtasks,extendedexecution,andactivitysponsoredexecution(forexample,theBackgroundMediaEnabledcapabilitywhichallowsanapptocontinuetoplaymediainthebackground).Also,backgroundtransferoperationscancontinueevenifyourappissuspendedoreventerminated.

Portanto,osaplicativosquevocêusanãosãocompatíveiscomissoesãosuspensosconformeoesperado.

NoWindowsSDK,existeumaferramenta para desativar o ciclo de vida de um aplicativo

"C:\Program Files (x86)\Windows Kits\Debuggers\x64\plmdebug.exe" /enableDebug <PackageFullName> 

Faça isso para os aplicativos que você deseja continuar.

    
por 21.04.2018 / 09:26