Reputation: 1299
I am trying to bring a closed app in windows phone 8 using LaunchUriAsync() and Package.Luanch().
I see that the problem with LaunchUriAsync() is that it has to called from a foreground application and it wont work when it is called from a background application. I am trying to launch an application using Periodic agents. I just want to bring it to the foreground. Thats it. This is because, the periodic agents have only 25 seconds of timespan.
In the package class. It says, i will be able to launch the package which has the same publisher ID as the launching application. I want to know if it is possible to do this from the background.
Upvotes: -2
Views: 174
Reputation: 16826
You simply can't. Imagine the experience users would get if all of a sudden they unlock the phone and some random app brings itself to the foreground. You can launch other apps from your own application, but for each you'd need explicit user permission.
Upvotes: 0
Reputation: 1636
From a UX standpoint, launching an app out of nowhere would be considered as a bad user experience and can confuse the user or interrupt their actions.
Whan you can do instead, is notify the user of your event using a tile notification, or better, a toast notification as this one will prompt the user to open the app if they want to.
This is an example of how to show a shell toast from a background agent:
protected override void OnInvoke(ScheduledTask task){
String toastMessage = "Periodic task running.";
ShellToast toast = new ShellToast();
toast.Title = "Background Agent Sample";
toast.Content = toastMessage;
toast.Show();
NotifyComplete();
}
See here for more info.
Upvotes: 0