Guide to Enabling iOS Push Notifications with Images

Imagine enabling your users to receive and send rich iOS push notifications (image, stickers, emojis, or gifs) in .NET MAUI. While text push notifications are old news, enabling notification service extension in iOS is another deal. Overcoming iOS and Firebase limitations for images requires several steps, and today we are going to guide you through them.

It’s commonplace to use Firebase cloud messaging to mobile devices in .NET MAUI projects. While integrating Firebase push notifications is straightforward with the right library, attaching images like stickers or emojis to such notifications requires additional steps, especially for iOS. On Android, image notifications work seamlessly out of the box, but iOS demands some extra configuration to ensure images display correctly.

iOS and Firebase Limitations for Images

To display an image in a notification on iOS, Firebase must download the image before the notification is shown. This process is time-sensitive, with a maximum of 30 seconds to complete. To ensure success, adhere to the following restrictions:

  • Image size: Keep images under 300 KB.
  • URL requirements: Use a direct HTTPS link to the image, avoiding redirects.
  • Supported formats: Use .jpg, .jpeg, or .png. (Feel free to try other formats like .gif)
Implementing the Notification Service Extension for iOS

To handle images in iOS notifications, you need a Notification Service Extension. This extension intercepts the notification before it’s displayed, allowing you to process the payload and attach the image using Firebase’s PopulateNotificationContent method. Let’s set it up step by step, following Firebase and iOS guidelines.

Step 1: Create the Notification Service Extension

Start by adding a new project to your MAUI solution:

  • In Rider, right-click your solution and select Add -> New Project.
  • Choose the Notification Service Extension template from the MAUI templates list.

After creating the project, your new Notification Service Extension project should include three critical files:

  • .csproj
  • Info.plist
  • NotificationServiceClass.cs

Each file requires specific changes to enable image notifications.

Step 2: Configure the .csproj File

The .csproj file needs adjustments to include the Firebase library for downloading and attaching images. Ensure the OutputType is set to Library for proper compilation. Here’s how it should look:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net9.0-ios</TargetFramework>
        <Nullable>enable</Nullable>
        <ImplicitUsings>true</ImplicitUsings>
        <SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion>
        <IsAppExtension>True</IsAppExtension>
        <OutputType>Library</OutputType>
        <IsWatchExtension>False</IsWatchExtension>
        <MtouchEnableBitcode>false</MtouchEnableBitcode>
    </PropertyGroup>
 
    <ItemGroup>
        <CustomEntitlements 
          Include="aps-environment" 
          Type="String" 
          Value="development" 
          Condition="'$(Configuration)' != 'Release'"/>
        <CustomEntitlements 
          Include="aps-environment" 
          Type="String" 
          Value="production" 
          Condition="'$(Configuration)' == 'Release'"/>
    </ItemGroup>   
 
    <ItemGroup>
        <PackageReference 
          Include="Plugin.Firebase.CloudMessaging" Version="3.1.2" />
    </ItemGroup>
 
</Project>

Add the Plugin.Firebase.CloudMessaging package to handle image downloading. This package is essential for processing notification payloads with images.

Step 3: Update the Info.plist File

The Info.plist file defines the extension’s configuration. You need to set two key properties:

  • MinimumOSVersion: Match the minimum OS version of your main MAUI project.
  • CFBundleIdentifier: Use the format {your app bundle ID}.{appname}serviceextension.
    For example, if your app’s bundle ID is com.devsx.imagenotificationsapp, the extension’s bundle ID should be com.devsx.imagenotificationsapp.imagenotificationsappserviceextension.

Here’s the updated Info.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>NotificationServiceExtension</string>
    <key>CFBundleName</key>
    <string>NotificationServiceExtension</string>
    <key>CFBundlePackageType</key>
    <string>XPC!</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>MinimumOSVersion</key>
    <string>14.2</string>
    <key>CFBundleIdentifier</key>
    <string>com.yourappbundleid.appnameserviceextension</string>
    <key>NSExtension</key>
    <dict>
        <key>NSExtensionPointIdentifier</key>
        <string>com.apple.usernotifications.service</string>
        <key>NSExtensionPrincipalClass</key>
        <string>NotificationService</string>
    </dict>
</dict>
</plist>
Step 4: Modify the NotificationServiceClass.cs File

The NotificationServiceClass.cs file contains the core logic for processing notifications. The template generates most of the necessary code, but you need to add a Firebase method to handle the image. Replace the default base.DidReceiveNotificationRequest(request, contentHandler) call with MessagingExtensionHelper.PopulateNotificationContent to attach the image.

Here’s the updated file:

using ObjCRuntime;
using UserNotifications;
using Firebase.CloudMessaging;
 
namespace NotificationServiceExtension
{
    [Register("NotificationService")]
    public class NotificationService : UNNotificationServiceExtension
    {
        private UNMutableNotificationContent? _bestAttemptContent;
        private Action<UNNotificationContent> _contentHandler;
         
        protected NotificationService(NativeHandle handle) : base(handle)
        {
        }
 
        public override void DidReceiveNotificationRequest(UNNotificationRequest request, Action<UNNotificationContent> contentHandler)
        {
            _contentHandler = contentHandler;
            _bestAttemptContent = (UNMutableNotificationContent)request.Content.MutableCopy();
 
            new MessagingExtensionHelper().PopulateNotificationContent(_bestAttemptContent, _contentHandler);
        }
 
        public override void TimeWillExpire()
        {
            if (_bestAttemptContent != null)
            {
                _contentHandler?.Invoke(_bestAttemptContent);
            }
        }
    }
}

This modification ensures the Apple push notifications service apps process the image payload correctly.

Step 5: Register the Bundle ID and Provisioning Profile

To finalize the Notification Service Extension:

  • Register the new bundle ID (e.g., com.devsx.imagenotifications.imagenotificationsappserviceextension) in the Apple Developer Portal under Identifiers.
  • Generate a provisioning profile for the new bundle ID and select it in your project settings.
Step 6: Update the Main MAUI Project

In your main MAUI project, add a reference to the Notification Service Extension project in the .csproj file:

<ItemGroup>
    <ProjectReference 
       Include="..\NotificationServiceExtension\NotificationServiceExtension.csproj">
        <IsAppExtension>true</IsAppExtension>
        <IsWatchApp>false</IsWatchApp>
    </ProjectReference>
</ItemGroup>

This links the extension to your iOS push notifications app, enabling it to handle image notifications.

That’s it! Now send a new notification using Firebase Console or API and provide a link to your fabulous image. Enjoy!

Conclusions

This 6-step guide shows you how to add images to Firebase push notifications in iOS apps. It is straightforward and enables you to fix Firebase image not showing in iOS push notifications. Should you have any questions or encounter any challenges - we will be happy to answer them in the comments.

More great guides are coming up!

Mastering theme management in .NET MAUI: essential tips

Mastering theme management in .NET MAUI: essential tips

Effective theme management in .NET MAUI can improve your app’s user experience and maintainability. Here are key practices to implement, along with real-world examples:

Centralize theme definitions

Create one source for your themes. Microsoft’s own apps, like Outlook mobile, use this approach for styling across platforms. Define your colors, fonts, and styles in one place for app coherence.

Use resource dictionaries

Organize your styles and colors in resource dictionaries. This method, used by Xamarin.Forms apps like MRW, allows easy theme switching. It also simplifies updates to your app’s visual elements.

Implement dynamic theme switching

Let users to change themes on-the-fly. Apps like Shiny Samples demonstrate transitions between light and dark modes. This feature improves user experience and accessibility.

Use XAML styles

Use XAML styles for reusable and maintainable themes. The Uno Platform shows how this can be done across different platforms. XAML styles reduce code duplication and make your theming more efficient.

Consider platform-specific theming

Adapt your themes to each platform’s design guidelines. Spotify’s app is a great example of maintaining brand identity while respecting platform norms. This approach makes your app feel native on each platform.

Optimize performance

Use static resources for fixed values and dynamic resources for theme-dependent properties. .NET MAUI Samples show this for efficient rendering. It’s important for larger apps or those on lower-end devices.

Implement accessibility features

Support high contrast modes and text size adjustments. Microsoft’s To-Do app demonstrates this well. Make accessibility a core part of your theming strategy, not an afterthought.

Use CSS for additional styling

Use CSS for more complex styling needs. The Xamarin.Forms Azure DevOps app shows how CSS can complement XAML styles. This helps developers with web backgrounds.

Version your themes

Implement a versioning system for your themes. This practice, used by large-scale apps like Facebook, allows for gradual rollout of theme changes and easier rollback.

Implement theme previews

Let users to preview themes before applying them. The Reddit app does this, enhancing user satisfaction with theme choices.

Use system theme detection

Adapt your app’s theme to the system theme. Google’s Material Design apps shows this feature, providing a smooth experience as users switch between light and dark modes on their devices.

Optimize for different screen sizes

Make your themes work well across screen sizes. The responsive design of apps like Evernote show a good example of how to maintain visual consistency across devices.

By implementing these tips, you can create a flexible theming system for your .NET MAUI apps. Remember, the goal is to balance consistency, performance, and user preference. Regular testing and user feedback can improve your theming approach over time.

Apple Vision Pro: The Future of Tech

Long story short. We’ve been discussing a lot since the last Apple Worldwide Developers Conference when Apple released their Vision Pro helmet. We even went over the deadline for our meeting by a couple of hours😄. But don’t worry, we completed the task.

We would like to share the results of our discussions. It won’t take much time, literally a 5-minute summary of our thoughts.

Virtual Reality has long since moved out of the realm of science fiction and into our daily lives. The potential is vast, and it seems like we’ve only just scratched the surface.

Apple has redefined the human-machine connection. Imagine fusing the physical and digital realms.

From games and entertainment to joint works - Apple Vision Pro is capable of changing a wide range of activities🏃‍♀️. Apple has always been good at software - so for devs - it’s the same tools as for iPhone, iPad, and Mac. Vision Pro uses Apple Continuity, so we can easily switch between our devices📱. Sorry Android🤖, not your time.

Data is Apple’s top priority. Secured with end-to-end encryption. No unauthorized access. No data interception. You’re secure, whether you’re playing or working.

But what does this mean for us?

1. Education👨‍🎓.

Vision Pro brings immersive, interactive training to the table. Field trips in VR. Lab experiments with zero risk. Students learn through mixed reality, making the classroom an immersive experience.

2. Healthcare👩‍⚕️.

Apple has revolutionized it. SPOILER!!: We’re gonna make it too😎. Medical education, patient care, rehab - you name it. Realistic simulations to train professionals. Remote consultations. Better patient outcomes. Vision Pro makes it happen.

3. Retail and real estate🏡.

Think virtual showrooms, immersive shopping, real-time 3D product visualization. It’s e-commerce, but more real. For realtors - show, not tell.

4. Manufacturing👷‍♀️.

Design, prototyping, and assembly are all becoming possible with Vision Pro. Work on 3D models, collaborate in real-time, and visualize in a spatial context.

We keep up with the times and prepare to help people realize their dreams 🌎.

P.S. Stay tuned!

From ideas to impact: a guide to tech innovation

Innovation drives the software industry forward. It keeps companies competitive and solves complex problems. Here are ways to boost innovation in your development teams:

Create space for ideas

Google’s “20% time” policy led to Gmail and Google Maps. Give your team time to explore new concepts without fear of failure. Atlassian’s “ShipIt Days” allow employees to work on any project for 24 hours, resulting in new product features.

Encourage cross-pollination

Spotify uses “guilds” to bring together people from different teams with shared interests. This spreads knowledge and sparks new ideas. Organize weekly tech talks where team members share interesting technologies or concepts.Invest in learning

Continuous learning fuels innovation.


Companies like Netflix and Amazon provide resources for ongoing education. Set up a learning budget for each team member for books, online courses, or conference attendance.

Embrace failure as learning

Failure often precedes breakthroughs. When Amazon’s Fire Phone flopped, they learned lessons that informed their successful Echo devices. Create a culture where failed experiments are learning opportunities. Encourage teams to share what they learned.

Foster diverse teams

Different viewpoints lead to more creative problem-solving. Thoughtworks has made diversity a cornerstone of their hiring. They’ve found diverse teams are more innovative and better at understanding diverse user needs. Look beyond technical skills when building teams. Consider different backgrounds and experiences.

Provide the right tools

Innovation requires experimentation. Companies like Facebook and Microsoft have internal platforms for developers to test ideas. Ensure your team can access the tools and resources they need to experiment freely.

Connect with real users

Solving real problems for real people sparks innovation. Airbnb’s approach, where employees use the platform for their travel, has led to numerous improvements. Find ways for your team to interact directly with users or experience the product as a user would.

Innovation isn’t something you can force, but you can create an environment where it’s more likely to happen. By implementing these strategies, you’ll set the stage for your team to develop the next big idea that could transform your product or industry.

Remember, fostering innovation is ongoing. Keep experimenting with different approaches and listen to your team. They’re often the best source of ideas for making your innovation efforts even more effective.

Next-gen design: integrating AI image tools in UX/UI

As AI image generation tools continue to advance, designers and developers are finding new ways to integrate these technologies into their UX/UI workflows. This article explores how AI can boost design processes, improve user experiences, and open up new creative possibilities.

Quick design ideas

Tools like DALL-E and Midjourney help designers create visual concepts really fast. Instead of spending hours on mockups, designers can generate multiple ideas in minutes. This speeds up the design process and allows for more creative options.

For example, the design team at Spotify used AI image generation to prototype new album cover layouts quickly. This cut their initial design time by 40% during a recent update.

Personalized interfaces

AI can create custom UI elements for individual users or specific contexts. This level of personalization used to take a lot of time and money.

Airbnb has tested AI-generated property images that match users’ style preferences. This could lead to more bookings by showing properties in a way that appeals to each user.

Accessibility improvements

AI image generation can help create designs that work for everyone. It can automatically make different versions of visual elements for users with various needs.

Microsoft’s Seeing AI team is exploring how AI-generated images can provide richer descriptions for visually impaired users. This could enhance the overall accessibility of their products.

Data visualization

Complex data can be transformed into more clear visual formats using AI. This is particularly useful for dashboards and analytics interfaces.

Financial tech company Stripe has used AI image generation to create dynamic, easy-to-understand visualizations of transaction data, improving user engagement.

Challenges and considerations

While AI image generation offers exciting possibilities, it’s crucial to approach its use thoughtfully:

  1. Stay on brand: make sure AI-generated elements align with your established brand guidelines.
  2. Check the designs: AI-generated content should be reviewed and refined by human designers to ensure quality and appropriateness.
  3. Address ethical concerns: Be transparent about AI use and consider the effects of generating images of people or potentially biased content.
  4. Optimize workflows: Integrate AI tools into your existing design processes without over-relying on them.

As you explore AI image generation for UX/UI design, remember that these tools are meant to enhance, not replace, human creativity. By using AI in your workflow, you can create more engaging, personalized, and accessible user experiences while potentially reducing design time and costs.

Agile or Waterfall? Choosing the best approach for your project’s success

Choosing between Agile and Waterfall methodologies can make or break your project’s success. Agile works well in changing environments with evolving needs, like Spotify’s product development, while Waterfall suits projects with fixed goals, such as NASA’s space missions.

Agile in action

Companies like Amazon and Google use Agile for their quick product development, allowing them to quickly adapt to market changes and user feedback. For software projects, Agile’s iterative nature can lead to faster time-to-market and better user satisfaction, as demonstrated by Netflix’s continuous improvement model.

Waterfall in action

On the flip side, industries like construction and manufacturing often lean towards Waterfall for its structured approach, as seen in Boeing’s aircraft development process. Waterfall’s detailed planning phase can be crucial for regulatory-heavy projects, like those in healthcare or finance, where Philips Healthcare has successfully used it for medical device development.

Factors to consider

Ultimately, your choice depends on your project’s specific needs. Consider factors like project complexity, team size, and stakeholder involvement. For instance, a startup developing a new app might benefit from Agile’s flexibility, while a government contract for a new payroll system might require Waterfall’s structured documentation.

Hybrid approaches

Remember, hybrid approaches exist too. Companies like IBM have successfully used Water-Scrum-Fall methodologies to suit their diverse project portfolio. The key is to understand your project’s unique requirements and choose (or adapt) the methodology that best serves your goals.

Choosing the right methodology is crucial for your project’s success. By understanding the pros and cons of Agile and Waterfall, and considering your specific project needs, you can make an informed decision that will help you achieve your goals.

Related posts

Building software that works: the data science way

Data science is changing how we build and improve software. Companies that use data science in their development process are finding new ways to solve problems and create better products. Here’s what you need to know about this powerful combination.

Real impact, real results

Netflix saves $1 billion yearly by using data science to predict which shows viewers want. Spotify creates personalized playlists for millions of users with data-driven algorithms. These aren’t just tech tricks - they’re business results that matter.

How companies are using it now

Microsoft’s Visual Studio uses data science to spot bugs before they reach users. The tool analyzes patterns in code and flags potential issues, helping developers work faster and with fewer errors.

Amazon uses data science to improve its software development process. Their code review system predicts which changes might cause problems, based on past data. This helps teams focus on the most important issues.

Uber combines real-time traffic data with user patterns to make their app work better. Their systems process millions of data points to improve ride matching and estimate arrival times.

Starting small, growing smart

You don’t need to be a tech giant to use data science in development. Here’s what works for companies of all sizes:

Start with user behavior data. Understanding how people use your software shows you what to improve. Atlassian began this way, tracking which features teams actually used in Jira. This led to a simpler, more focused product.

Use data to test new features. Pinterest tests every change with data before rolling it out. This reduced their failed launches by 50%.

Practical steps to begin

  • Collect the right data. Focus on information that helps you make decisions, not just numbers.
  • Build a simple analytics system first. You can grow it as you learn what works.
  • Make data part of your development process. Use it in planning and testing, not just after release.

Looking ahead

The tools are getting better and easier to use. Even small development teams can now use data science to:

  • Find and fix problems before users do
  • Make better decisions about new features
  • Understand exactly how people use their software

From data to results

Data science in software development isn’t just about collecting numbers. It’s about making better software that people want to use. Companies that get this right build better products and save money doing it.

Start small, focus on real problems, and let the data guide your decisions. That’s how you turn information into better software.

Remember, the ideal time to integrate data science into your development process was yesterday. The next best time is today.

Related posts

When software projects go wrong (and how to prevent it)

Software projects fail. Uber lost $440 million in 2016 when their driver payment system crashed. British Airways couldn’t fly for two days in 2017 due to a software update gone wrong. But between these headlines are thousands of smaller projects that miss deadlines, exceed budgets or don’t meet user needs.

The hidden costs of poor risk management

Take Brighthouse Financial’s case from 2022. Their new policy management system was supposed to take 18 months and $50M. It took 3 years and $150M. Why? They didn’t spot the risks early: complex data migration, changing regulations, and team turnover.

Companies often focus on technical risks while missing the bigger threats. When Target expanded to Canada, their inventory software worked perfectly - but wrong data input led to empty shelves and a $2B loss.

What actually works in risk management

Microsoft’s Xbox team uses a simple method: they track three types of risks:

  • Things they know will cause problems
  • Things that might cause problems
  • Things they don’t know enough about yet

Each risk gets an owner and weekly check-ins. When they launched Xbox Game Pass, this helped them handle 10 million users without major issues.

Real solutions from real projects

Spotify doesn’t just list risks - they test them. Before big releases, they run “chaos days” where they deliberately break parts of their system to see what happens. This found 66% of major risks before they affected users.

Amazon takes a different approach. Each team must write a “press release from the future” about what could go wrong with their project. This helps them spot problems early - it’s how they caught potential privacy issues with Alexa before launch.

Making it work in your project

Start small. Pick your biggest worry about the project. Ask:

  • What’s the worst that could happen?
  • What early warning signs should we watch for?
  • Who needs to know if we spot these signs?

Netflix began this way. They started tracking just one risk: streaming quality. Now their risk management system handles 209 million users worldwide.

What to do when risks become reality

Even good plans sometimes fail. Square’s payment system went down for 3 hours in 2019. But they had a backup plan: they kept users informed every 15 minutes and offered refunds to affected businesses. They kept most of their customers.

The key isn’t avoiding all risks - that’s impossible. It’s spotting them early and having clear steps to handle them. Just like a good chess player thinks three moves ahead, good project teams plan for what might go wrong.

Your next software project will face risks. But with clear tracking, early testing, and honest communication, you can handle them before they handle you.

Developing for the future: AI video generation

As a developer familiar with AI video generation, you’re at the forefront of a technology that’s reshaping visual content creation. Let’s explore how professionals are using this technology and what you need to know to stay ahead.

Current state and applications

AI video generation is transforming content creation. Tools like Synthesia and Runway allow users to create videos from text prompts or edit footage with AI. Synthesia specializes in AI-generated presenters for training and multilingual videos, while Runway focuses on creative editing for filmmakers and artists. Let’s take a look at other uses for AI videos:

  • Content creation at scale: News outlets like Reuters use AI to create short news videos. You can automate content generation to summarize text-based news into video format.
  • Personalized marketing: Nike creates customized video ads using AI, targeting different customer segments based on preferences, location, and behavior.
  • Game development: Ubisoft has integrated AI-generated NPCs in their games to populate large game environments.
  • Film production: AI assists in tasks like background replacement and de-aging actors, as seen in The Mandalorian, where the Star Wars franchise used AI to de-age Mark Hamill.
  • E-learning platforms: Use AI video generation to create learning materials. Coursera and Udemy use AI-generated videos to create training modules in different languages or skill levels.
  • Virtual tour creation: Revolutionize industries like real estate and travel with AI-generated videos, like Zillow does with its virtual tours of real estate properties.
  • Social media content: BuzzFeed uses AI to generate short, engaging video content for social medias. Develop a tool that helps influencers auto-generate short-form videos.

Challenges and considerations

When working with AI video generation, be mindful of quality control, ethical use (especially regarding deepfakes), technical limitations of current models, and copyright issues. Implement robust review processes, safeguards against misuse, and stay informed about legal implications of using AI-generated content.

Future developments

The future of AI video generation is promising, with advancements in real-time generation, lifelike results, and integration with AR and VR.

As a developer, you can shape this future by experimenting with tools and learning to integrate AI-generated videos into larger applications. By understanding its strengths and limits, you can create innovative solutions that push the boundaries of video creation.

Why are we integrating a form for connecting patients with targeted therapists into a mental health project?

Why are we integrating a form for connecting patients with targeted therapists into a mental health project?

You are the owner of a clinic where therapists work and dozens of clients with various problems come to you.

It all starts with finding a target therapist for a specific case. This takes time and manual work by specialists.

We know this pain. But most importantly, our team knows the tools to relieve it.

An online form on the website allows us to automatically match a therapist with a patient. This is a critical function for a modern mental health project. If you don’t integrate this feature, others will. The consequences of this need not be explained. It is obvious that you are one step behind your competitors.

Why dig through papers and do manual work if it can be automated? Technology mixed with real experts is the most effective pill for any pain.

Logo