I'm facing an issue with push notifications in .NET MAUI. I'm using Firebase Cloud Messaging and I have successfully integrated it into my app. The problem is with the notification icon; when I receive a notification while using the app, the icon is displayed correctly, but if I receive the notification when the app is closed, the icon appears small and inside a larger circle (which doesn't look good). I've tried using both SVG and PNG files with colored or white and transparent backgrounds, but nothing seems to work. That's the image I have used.
Here are the screenshots of the problem:
Inside the app:
And if I scroll down while in the app:
Outside the app (when closed):
And again, if I scroll down while the app is closed:
These examples were made using a PNG file named small_notification_icon.png and saved in the Resources/Images folder, which only uses white color with a transparent background. This is the code I used:
var notificationBuilder = new NotificationCompat.Builder(this, MainActivity.ChannelID)
.SetSmallIcon(Resource.Drawable.small_notification_icon)
.SetContentTitle(title)
.SetContentText(messageBody)
.SetChannelId(MainActivity.ChannelID)
.SetPriority((int)NotificationPriority.High);
var notificationManager = NotificationManagerCompat.From(this);
notificationManager.Notify(MainActivity.NotificationID, notificationBuilder.Build());
I would appreciate any help or suggestions on how to resolve this issue.
I've identified the issue. When the app runs in the background, notifications sent from the console use the launcher icon designated in the manifest file.
To address the problem, you can simply replace the default image specified in the AndroidManifest by inserting the following code within the Application tag. All you need to do is substitute your_favourite_image with the image you prefer for the notification icon.
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/your_favourite_image" />
This should resolve the issue and allow you to use your preferred image for notifications.
Related
I have a mobile app in Xamarin where a QR-code scanner is needed. Scanning the code works fine... After scanning a code, the user is redirected to another page. After checking out this page, the user is redirected to the page where the scanner is located. So, when this redirection happens, I get the error Java.Lang.RuntimeException: 'getParameters failed (empty parameters)'... I googled for hours but couldn't find any solution for this problem. BTW, it also happens when I use the 'back' button on the emulator or real word Android device...
--SOLVED--
Changing the PushAsync(pageX()) to PopAsync(); worked in my case. Found out that the problem is bases around getting the camera parameters. These are not available, because the camera is already using it in the former screen. So closing the camera/ending the camera activity is also a solution!
I am trying to play an audio stream from stream server in my windows phone app. I read on Microsoft Documentation that I have to reference an Audio Stream Agent.
I have these projects in my solution :
I've tried to reference a new project as Audio Streaming Agent in my Windows Phone 8.1 application
but I keeping receiving the error :
I read that I have to change the target framework, but there is no option for target framework in the AudioStreamAgent1 properties.
Also, Can I do this using an application that is not the Silverlight kind? Is there a way to do without using the Silverlight one?
The problem is that the AudioSteamAgent is targeted at WP Silverlight, and your actual app is WP8.1 (WinRT).
To create background audio in WP8.1, you will want to use the Background Media Player.
You can find a great guide for how to get started here.
But basically (without all the boilerplate code to wire everything up), it comes down to telling the BMP what to play (code is from the link above):
BackgroundMediaPlayer.Current.SetUriSource(new Uri("ms-appx:///Assets/Media/Ring02.wma"));
BackgroundMediaPlayer.Current.Play();
And telling the OS player controls what to show, and what to do when the user interacts with them:
systemmediatransportcontrol = SystemMediaTransportControls.GetForCurrentView();
systemmediatransportcontrol.ButtonPressed += systemmediatransportcontrol_ButtonPressed;
systemmediatransportcontrol.PropertyChanged += systemmediatransportcontrol_PropertyChanged;
systemmediatransportcontrol.IsEnabled = true;
systemmediatransportcontrol.IsPauseEnabled = true;
systemmediatransportcontrol.IsPlayEnabled = true;
systemmediatransportcontrol.IsNextEnabled = true;
systemmediatransportcontrol.IsPreviousEnabled = true;
This is all assuming that you want the user to be able to leave the app and have media continue to play. If you just want to stream audio/video while the user is in the app you can use the MediaElement control.
I have an app that captures images from the device's camera and saves them as StorageFiles to a folder in my app's roaming data. I've been trying to make a page that will open the image and show a preview, but I've been having many problems doing that, so I want to just open the image in the default photos app. However, I can't find any way to do that. Using await Launcher.LaunchUriAsync(new Uri(#"ms-appdata:///roaming/folder/img.jpg")); asks if I want to search for an app in the Store (searches for "ms-appdata"). Does the native Photos app for Windows (Phone) have a dedicated URI scheme? Also, I am targeting Windows 10 with this app, so the URI schemes (if any) may have changed.
Launcher.LaunchUriAsync is for launching an application using the URI scheme, this is not what you want.
Instead you'll want to launch an app based on a file:
Get the image as a StorageFile
var imageFile = await StorageFile.GetFileFromPathAsync(#"ms-appdata:///roaming/folder/img.jpg");
Then you tell the OS to launch an app to handle that file. It's then up to the user to choose which app to handle the image file:
var success = await Windows.System.Launcher.LaunchFileAsync(imageFile);
You can read more about "launching" files here.
I'm trying to log in to a server through remote desktop using c#. I'm able to initiate the connection using the AxMSTSCLib and the code below. However, I'm stuck on our domain's security notice.
When logging in manually it requires you to click ok on the notice before the log in completes. I have been unable to find anyway to interact with this OK button through my application. I've tried variations of SendKeys, sending key events using interop services, finding the cursor position and sending a mouse click event...
I'm running out of ideas here.
rdp.Server = server;
rdp.Domain = domain;
rdp.UserName = userName;
IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx();
secured.ClearTextPassword = password;
rdp.StartConnected = 1;
rdp.Connect();
Thanks
Well, there is a way to do what you ask.
You will need to download a copy of Windows 7 Embedded Standard (WES7 wSP1).
WES7 contains something that other editions of Windows 7 do not - a Dialog Filter.
It runs as a service, and allows you to specify certain window events to be performed automatically, without user interaction.
The Dialog Filter Editor is installed with the Windows Embedded Standard 7 tools in the EmbeddedSDK\bin folder.
All you have to do is:
Add the service to your Windows, by copying the necessary Dialog Filter files to C:\Windows\System32. There are x86 and x64 versions, so choose the correct architecture.
Register the files, and enable the service to run automatically.
Add the ConfigurationList.xml file created with the editor to C:\ProgramData\Microsoft\DialogFilter.
This location is hidden by defeault, so make sure to show hidden files and unhide protected system files in Windows Explorer.
I've actually created the ConfigurationList.xml file already, so you can simply copy the following code and save it as "ConfigurationList.xml":
<?xml version="1.0" encoding="utf-8"?>
<CL:dialogs xmlns:CL="urn:Dialogs">
<dialog>
<ProcessImageName>rundll32.exe</ProcessImageName>
<Title>Remote Desktop Connection</Title>
<Class>#32770</Class>
<Buttons>
<Button>OK</Button>
<Button>Cancel</Button>
<Button>Close</Button>
</Buttons>
<Actions>
<Action>OK</Action>
</Actions>
</dialog>
</CL:dialogs>
As you can see, the action is set to press the OK button automatically in the RDP dialog that pops up when making an RDP connection.
More info regarding the Dialog Filter directly from MS:
https://msdn.microsoft.com/en-US/library/ff794135(v=winembedded.60).aspx
Just found a much easier way to do this:
There's a free small app called ClickOff, which works in a very similar manner to Windows Embedded Standard 7 DialogFilter.
You can download ClickOff v1.90 here.
After you install ClickOff, you can define which window to capture, and which button inside it to click. Only thing is that you must add it to your startup apps.
I have already created a clickoff.lst file which clicks OK on the 30-sec RDP timeout popup window. The file should be placed in C:\Users\USERNAME\AppData\Roaming\ClickOff. Here's the contents of the file:
1.900
WINDOWTITLE="Remote Desktop Connection" BUTTONTEXT="OK" MSGTEXT="CompName\\UserName wants to connect to this machine.\r\n\r\nClick OK to disconnect your session immediately or click cancel to stay connected.\r\n\r\nOtherwise, you will be disconnected in 30 seconds." BUTTONID="1" MSGID="65535" DLGID="0" CLKEVENT="17" CLKMETHOD="3" TIMESCLICKED="0" WAIT="0" BPOSX="0" BPOSY="0" ;
Cheers.
I am having an issue getting into the camera roll folder for Windows Phone 8. Unfortunately due to the project being a MonoGame Project, the MediaLibrary object is not implemented and thus does not work. I am left with having to directly tap into the camera roll folder directly, through I am getting an
Access Denied
Error as a result. The idea is that if I know the location of the file in the future, I can display it in certain parts of my app after the user has taken a photo using the app. The code is as follows:
StorageFile folder = await StorageFile.GetFileFromPathAsync("Pictures\\Camera Roll\\WP_20130227_001.jpg");
I have also checked off:
ID_MEDIALIB_PHOTO
and am still getting the error.
Any help is greatly appreciated!
Try using the photochoosertask..
PhotoChooserTask selectphoto = new PhotoChooserTask();
selectphoto.Completed += new EventHandler<PhotoResult>(selectphoto_Completed);
selectphoto.Show();
this might help.