question

Charles-1703 avatar image
0 Votes"
Charles-1703 asked WenyanZhang-MSFT commented

How do I make an alarm force-open my application?

I'm trying to make a very simple timer/alarm app in Xamarin for Android.
I have the timer, it ticks down, and when it hits 0, it sends a push notification.
But I want more, I want it to open my app up from sleep, to the page the timer was on, and display the name of the alarm.


I am using:
Xamarin.Android.Support.V4
Xamarin.Essentials
Xamarin.Forms

Any help would be appreciated.

dotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You could see Android Job Scheduler, and check if AlarmManager is helpful. I also suggest you could try to run a Foreground Services, then your service will not be killed by Android System.
I'm not very clear how did your timer work, and how did you send the notification, you could try to launch your app by the package name :

  Intent intent = PackageManager.GetLaunchIntentForPackage("com.companyname.***");
             StartActivity(intent);
0 Votes 0 ·

0 Answers