How to display UI for App Center Crashes in UWP - c#

We have a UWP app in which we send crash reports using the App Center Crashes api.
In the docs there is a section about displaying UI to the user that a crash report is being submitted, has sent or has failed.
We have been unable to call our own custom UI.
Is there an example on how to call custom UI?
Crashes.SendingErrorReport += async (sender, e) =>
{
// Your code, e.g. to present a custom UI.
};

We don't have any OnProgress-type of callbacks, so the only option is using 3 events we have:
SendingErrorReport, SentErrorReport and FailedToSendErrorReport.
There is no snippets of usage in UWP demo\puppet apps I can show, but you can have a look at WPF code for example, callback signatures are the same.
Basically what you described in original post is correct. I think that something like MessageDialog (documentation is here) is what you are looking for.
Hope that helps.

I can confirm - I was just trying the same issue on UWP - it does NOT work. Will see how I can submit an issue to Appcenter (apparently i don't have enough reputation to add it as a comment).

Related

How to create in xamarinforms/android what will remind you of a call in IOS?

I am creating an application in which I have calls, when a call occurs, my application shows a notification like in the picture below.
Pictures for example!!! I do for android
The problem is that the notification is hidden in the curtain on its own, although the call is still in progress, but I need it to be displayed all the time while the call is in progress. For example, like on the Iphone, something like this
Below is the standard code for building the appearance of a notification that I use.
I thought about how to extend the time when the notification is displayed on the screen, but have not found a solution yet ((
Notification noti = new Notification.Builder(mContext)
.setContentTitle("New mail from " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail)
.setLargeIcon(aBitmap)
.build();

How to show a progress bar notification in xamarin forms

I am using xamarin forms and i came across this plugin https://github.com/thudugala/Plugin.LocalNotification in order to show notifications to user. But how can a progress bar be shown on notification area?
I cant find an example of how this is done.
This is the code i use for sending notification
CrossLocalNotifications.Current.Show("title", "body");
Is there a cross platform solution as the above example? Or a correct implementation using Dependency Services?
What you're trying to achieve is not possible with the local notification plugin. However, it should be rather trivial to extend the library to add an additional argument for the progress data shown on the progress bar.
Basically, you just need to pass two additional values from the Notification Builder by calling the SetProgress(int max, int progress, bool intermediate) method. This is best explained in Google's Android documentation here.
The method were you should add the call to SetProgress() is ShowNow() in the Android specific class /Platform/Droid/NotificationServiceImpl.cs. Of course you also need to make changes elsewhere so that you can provide the max and progress values from the cross-platform code.
If the above solution seems too complex and you're not using the plugin extensively, perhaps you can just construct the notifications yourself in the Android project and execute that code using the dependency service.
Edit: I removed the Google Books link which doesn't seem to work for everyone. Instead, here is an article from Microsoft Docs, detailing how the local notifications can be created. The only additional thing that is missing from the guies is the SetProgress method which is required to show the progress bar.
Also, notice that you need to submit the notification again and again to show progress in the progress bar. Check the third reply (from Cheesebaron) on this thread in the Xamarin Forums for a short explanation and bits of code on how it works.

Windows Phone 8 resume/suspend /activated/deactivated

I am currently trying to make an app that takes some data from a server. I have a list and I am populating it when I login with some data. The idea is that that data can change over short periods of time. I made an auto refresh button, works fine, but I wanted to implement something like this:
When you open the app, everything loads, is good (done).
If you minimize (put in taskbar, I don't know how to say, enter on another app or menu). Your app will be suspended. When you resume it, I want it to perform the refresh thing. (Need help).
I'm currently working with Windows Phone 8, started project on this one and want to finish with this one. App.current. doesn't have resume or suspend, which I have found on lots of YouTube videos or on the MSDN site. Therefore I think I should do something with activated / deactivated, but I don't know where to add this handler. On the MSDN site I only found the function.
I am looking for something like this: Event on returning to app, after exiting by Windows key [UWP][Win10 Mobile], but as I told, I don't have this.suspend / this.resume on Windows Phone 8.
If we talk about Windows Phone 8, we have to specify which app flavor is intended.
For Silverlight apps, there are Application_Activated() and Application_Deactivated() methods, usually they're auto-created automatically in the App.xaml.cs
For so called "RT apps" there are events Suspending and Resuming, 1st one is subscribed automatically in the App.xaml.cs (so just put your code into that auto-generated handler), and you have to subscribe to 2nd one by yourself.

background task in windows phone 8.1

I am using a 3rd party rest api to query data and display it in my app. I have to perform a task like at night 12 approx. it will perform a background task to query data from rest api and update live tile and generate notification. I would like to use only C# only for this task. I don't know what will be best approach to do this task. But I using below code to perform background task to do this which is not working. Not sure why?
BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder();
taskBuilder.Name = taskName;
SystemTrigger trigger = new SystemTrigger(SystemTriggerType.InternetAvailable, false);
taskBuilder.SetTrigger(trigger);
taskBuilder.AddCondition(new SystemCondition(SystemConditionType.InternetAvailable));
taskBuilder.TaskEntryPoint = typeof(BackgroundTask.BackgroundTask).FullName;
taskBuilder.Register();
and from background task I am querying data and generating toast notification.
Any help why this code is not working or when this task will fire. Is there any better approach to do above task?
Thanks
Regarding the code you have not working...
For Windows Phone 8.1 unlike Windows 8\8.1, you are required to call BackgroundExecutionManager.RequestAccessAsync() (search MSDN\internet) for ANY background task before registering task(s) whereas in Windows this is only required for some tasks. Make sure your code calls this and validate the returned value before registering your background task(s).
Regarding knowing if your task "worked"...
It's a good idea to have the background task implementation run (IBackgroundTask::Run()) independent of the trigger\conditions you've set to ensure it performs without issue by debugging it. See instructions in the following link: http://msdn.microsoft.com/en-US/library/windows/apps/xaml/jj542416.aspx.
Regarding your use of SystemConditionType.InternetAvailable...
I'm not 100% about this but I'm pretty certain this will be redundant given you already have a SystemTriggerType.InternetAvailable. I don't know of a situation where the trigger would fire but the condition wouldn't be true.
Regarding the requirement you've mentioned...
If I understand your requirement correctly you have different options here:
If your app is a Windows Phone XAML app that need to run based on time, I would recommend either TimeTrigger or MaintenanceTrigger triggers (as opposed to the SystemTrigger). These are both Background Tasks. For general info on Background Tasks and links to the TimeTrigger and MaintenanceTrigger documentation see this MSDN link: http://msdn.microsoft.com/en-US/library/windows/apps/xaml/hh977056.aspx.
If your app is a Windows Phone Silverlight 8.0 app you can use Background Agents, specifically either PeriodicTask or ResourceIntensiveTask. See the links posted by others or search the MSDN\internet for more info.
If your app is a Windows Phone Silverlight 8.1 app you can use the option in either 1 or 2 above.
I think you should try using PeriodicTask. Also consider the constraints mentioned in the link.
create one class with output Type :Windows Runtime Component
and put your Class that inheritance from IBackroundTask so this work
if you use from emulator for launching app, i think your app for register task not active in emulator.

Windows 7 - Disable Close Program/Debug Program Dialog, yet crash dump and notify the user

I'm developing a commercial Windows 7 desktop application (somewhat shrink wrap, but not quite). The application has both Windows Service and a WPF User Interface components. In the event that our application fails at a customer site we want to be able to capture information about the runtime environmnent, including a crash dump of our processes to a dump location. That information could then be forwared to our support personnel upon request for further investigation. We also want to turn off any Windows Error Reporting and Send To Microsoft dialogs that might popup as a result of the failure.
The important thing is that we only want this to affect our application processes. We don't want to affect some global setting that will change the way all other applications on the customers desktop report fatal errors.
I'm looking for some suggestions and best practices for doing this sort of thing in a shrink wrap application.
The best way I know how to do this is by subscribing to the AppDomain.CurrentDomain.UnhandledException event. There you will be able to use the Win32 API function MiniDumpWriteDump to create your own minidump file. Check out this blog post to see a good example. Also, there is the ClrDump library.
Before you exit from your UnhandledException handler, call Environment.Exit() and you shouldn't see any more Windows error dialogs.
I have not actually used these minidump libraries myself yet, but I will soon. Hopefully this answer will at least give you a few keywords that you can plug into Google.

Categories

Resources