An example implementation of using a native iOS Notification Service Extension (to display images in remote push notification) in Titanium.

Overview

Titanium iOS Notification Service Extension

An example implementation of using a native iOS Notification Service Extension (to display images in remote push notification) in Titanium.

Requirements

  • A basic understanding of working with native iOS extensions in Titanium, see this guide for reference.
  • A push notification server that can handle own APS payloads, e.g. Firebase Messaging, OneSignal or Urban Airship
  • A physical device to test - notification service extensions do not work in Simulator

Usage

  1. Copy the NotificationServiceExtension directory to <project>/extensions
  2. Change the extension app ID (search for com.example.app, e.g. in VSCode) to your app identifier
  3. Generate a new app ID for the extension in Apple Developer that matches <your-main-app-id>.MyNotificationServiceExtension.

Note: We generated the MyNotificationServiceExtension suffix by default. If you wish to change it during app ID creation, make sure to also change it in the code

  1. Generate new provisioning profiles matching the new extension app ID (one for development and one for production)
  2. Add the following to your tiapp.xml:
<extensions>
    <extension projectPath="extensions/NotificationServiceExtension/NotificationServiceExtension.xcodeproj">
        <target name="NotificationServiceExtension">
            <provisioning-profiles>
            <device>YOUR_DEVELOPMENT_PROVISIONING_PROFILE_ID</device>
            <dist-appstore>YOUR_PRODUCTION_PROVISIONING_PROFILE_ID</dist-appstore>
            <dist-adhoc>YOUR_PRODUCTION_PROVISIONING_PROFILE_ID</dist-adhoc>
            </provisioning-profiles>
        </target>
    </extension>
</extensions>
  1. Run the app on your physcial device to make sure it compiles correctly. Validate in the generated Xcode project (in build/iphone/<your-app-name>.xcodeproj) that the app extension was linked correctly.
  2. Prepare a sample push notification with the following structure:
{
    "aps": {
    	"alert": {
	    "title": "My Notification Title",
	    "body": "My Notification Message",
        },
	"sound": "default",
	"category": "MyAttachmentCategory",
        "mutable-content": 1
    },
    "attachment": "MY_IMAGE_URL"
}

Note: In this example, the Info.plist restricts the push handling of attachments to MyAttachmentCategory. You can change the category or remove this restriction in NotificationServiceExtension/NotificationServiceExtension/Info.plist.

  1. Send the notification! If it succeeds, the push notification will contain the image at the right side of the notification.

Author

Hans Knöchel

License

MIT

You might also like...
A simple framework to output to a file, url, the console, or even register notification using UserNotifications

o is a simple framework to output to a file, url, the console, or even register notification using UserNotifications. o can also get input from a file, url, or console.

React Native utility library around image and video files for getting metadata like MIME type, timestamp, duration, and dimensions. Works on iOS and Android using Java and Obj-C, instead of Node 🚀.

Qeepsake React Native File Utils Extracts information from image and video files including MIME type, duration (video), dimensions, and timestamp. The

Yummies is my first attempt at building a native iOS app using Swift and SwiftUI

Yummies is my first attempt at building a native iOS app using Swift and SwiftUI. A recipe browser where you can pin your favorite ones. Powered by Edamam Recipe Search API.

Display news feed and stock tickers.

Test Assignment Display news feed and stock tickers. Features First section The first section should contain list of horizontal tickers with symbol an

A Swift package that provides convenient Lorem Ipsum text, images, colors and other placeholders for rapidly prototyping, building and testing your iOS applications.
A Swift package that provides convenient Lorem Ipsum text, images, colors and other placeholders for rapidly prototyping, building and testing your iOS applications.

Lorem Introducing Lorem, a placeholder generator library for iOS to help you rapidly prototype, build and test your iOS applications. By leveraging Sw

A react native interface for integrating payments using Braintree

A react native interface for integrating payments using Braintree

A property finder application written using React Native

React Native PropertyFinder App This repository accompanies the tutorial I published on Ray Wenderlich's website, which describes the process of build

Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.
Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.

Create an easy to peek SwiftUI View to showcase your own data, catalog, images, or anything you'd like.

Owner
Hans Knöchel
✨ CEO Lambus, prev. iOS lead @appcelerator, maintainer @TiDev
Hans Knöchel
Docker images for Swift on Raspberry Pi and other ARM devices from balena's base images.

Swift on Balena Welcome to Swift on Balena – a set of Docker images for Swift on Raspberry Pi and other ARM devices. These images are based on balena'

Will Lisac 173 Dec 5, 2022
Easy-to-use segues in SwiftUI, allowing for presenting views using common UIKIt Segue types - push, modal and popover

Easy-to-use segues in SwiftUI, allowing for presenting views using common UIKIt Segue types - push, modal and popover

Gordan Glavaš 5 Apr 16, 2022
An alternative to using the native UIAlertController, with a thoughtful design and simple implementation.

HPAlertController An alternative to using the native UIAlertController, with a thoughtful design and simple implementation. Requirements iOS 15.0 and

Hugo Pivaral 8 Nov 13, 2022
React Native library that implements PayPal Checkout flow using purely native code (swift).

react-native-paypal-swift React Native library that implements PayPal Checkout flow using purely native code (swift). Installation npm install react-n

Tibb 6 Nov 28, 2022
A simple, reliable and scalable delivery API for transactional push notifications for websites and applications

Catapush is a simple, reliable and scalable delivery API for transactional push notifications for websites and applications. Ideal for sending data-dr

Catapush 0 Dec 29, 2021
React Native Todo List example app which uses Redux for managing app state

react-native-redux-todo-list A sample todo list app developed by using React Native and Redux. How to run the app Install react-native If you don't ha

null 43 Oct 11, 2022
Keybase Go Library, Client, Service, OS X, iOS, Android, Electron

Keybase Hi, and welcome to the Keybase client repo. All our client apps (macOS, Windows, Linux, iOS, and Android) are being actively developed in this

Keybase 8.3k Dec 31, 2022
Vapor-telemetrydeck - Vapor client for posting signals to TelemetryDeck, a privacy-conscious analytics service for apps and websites

Vapor-telemetrydeck - Vapor client for posting signals to TelemetryDeck, a privacy-conscious analytics service for apps and websites

Sidetrack 7 Jun 16, 2022
Some code for playing with the Teenage Engineering Ortho Remote

ortho-remote C program for interfacing with the Teenage Engineering Ortho Remote. Currently only implemented for macOS Puts the remote into MIDI mode

Rasmus 13 Oct 18, 2022
Vahesaroyan-react-native-bubble-select - React native bubble picker

@vahesaroyan/react-native-bubble-select React native bubble picker Installation

Vahe Saroyan 0 Jan 30, 2022