I have an app with a local notification. The problem is that it displays the "Project name" that comes from Visual Studio (see the screenshot). I would like the app to display something I can specify (the application name).
[
The code to build the notification you see above is :
PendingIntent resultPendingIntent = stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent);
// Build the notification:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.SetAutoCancel(true)
.SetContentIntent(resultPendingIntent)
.SetContentTitle("Button Clicked")
.SetNumber(count)
.SetSmallIcon(Resource.Drawable.ic_stat_button_click)
.SetContentText(String.Format("The button has been clicked {0} times.", count));
// Finally, publish the notification:
NotificationManager notificationManager = (NotificationManager)GetSystemServiceContext.NotificationService);
notificationManager.Notify(ButtonClickNotificationId, builder.Build());
I'm testing with Android 7.0 and it seems like the local notification documentation does not show anything about this "new" way of displaying a notification. I am able to change the small icon though.
I could not find anything on Xamarin forums or Google about that problem. I truly doubt people want to see the Visual Studio's project name there.
I even downloaded the local notification sample project and it shows the project name.
Is it a limitation or am I missing something ? It seems to me like something too important to be a limitation.
To request a permission from the users, use the RequestAsync method along with the specific permission to request. If the user previously granted permission and hasn't revoked it, then this method will return Granted immediately and not display a dialog. var status = await Permissions.
Local notifications are scheduled by an app and delivered on the same device. They are suited for apps with time-based behaviors, such as calendar events. When you run your app on a device with Android OS 8.0 or above, Kony uses default channels that are mentioned in the localnotificationconfig.
You are looking for the Android application's android:label
in the AndroidManifest.xml
, known as the "Application name" in the Xamarin.Android project settings.
~~~~
<application android:label="StackoverFlow" ~~~
~~~~
Note: Instead of setting this directly in the AndroidManifest.xml
, you can also use an assembly level ApplicationAttribute
:
[assembly: Application(Icon = "@drawable/Icon", Label = "StackOverflow")]
FYI: Xamarin's project template creates this Application attribute in AssemblyInfo.cs
with an Icon parameter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With