Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to make a WinRT service

Since WinRT have unique capabilities, I wonder if it were to make a Windows Service that is targeted to WinRT? If it were not possible, is the workaround to make an invisible WinRT/Metro application possible?

Thanks a lot.

like image 344
user1343145 Avatar asked Apr 26 '12 02:04

user1343145


2 Answers

No is the correct answer. A metro application executes inside the Metro shell and inside an execution container that creates a sandbox away from system resources, including services. For this reason a metro app cannot access a local service. Similarly, for this reason, a metro app cannot be a service.

Background tasks and push notifications through Windows Notification Services are the only way for a metro app to interact with the user while not active. Otherwise, when the application is not active (not visible), all of its threads are suspended (unlike a service).

As for background tasks, their activity is constrained identically to a metro app and limited to a single CPU second every 2 hours (there is one exception). Push notifications can execute more frequently, but are only capable of updating a tile or raising a toast notification.

The intent of a metro application is different than a traditional desktop application:

Metro applications are architecture independent (run on intel or arm). Metro applications are touch-reach, built for touch screens. Metro applications are fully hardware accelerated. Metro applications leverage the next gen hardware that certified devices offer, including unprecedented battery life. Metro applications are the only applications delivered by the Windows store.

Look, choosing a metro application does mean to concede some of the unlimited power of desktop applications. However, the gains are significant, too.

like image 125
Jerry Nixon Avatar answered Oct 06 '22 22:10

Jerry Nixon


Nope this isn't possible (wither the service, or the "invisible" metro application).

You can run background tasks that may do what you are after, but without understanding your problem I couldn't say.

like image 41
Ross Dargan Avatar answered Oct 06 '22 22:10

Ross Dargan