sorisdk_flutter
Add SORI-powered audio recognition to Flutter apps, so audiences can interact with TV, radio, cinema, and other media from their phones. When registered media is recognized, your app can show the matching campaign, product information, coupon, event, or action link managed in SORI Console.
This package wraps the native SORI Android and iOS SDKs with a Flutter API for starting recognition, receiving campaign/result events, updating the recognition database, and reporting handled action URLs.
When to use it
Use this plugin when your Flutter app needs a second-screen experience for:
- interactive ads and commerce links
- coupons, events, quizzes, or promotions tied to broadcast content
- product, cast, location, or soundtrack information while users watch or listen
- exposure and click reporting for media campaigns
Learn more in the SORI API docs, Use Cases, and SORI Console overview.
Setup
Before integrating the Flutter package, prepare SORI resources in SORI Console:
- Create an
app_idandsecret_keyin Managing Application. - Register the media that should be recognized in Managing Material.
- Link a campaign, image, and action URL in Managing Campaign.
Then create a recognizer with your SORI application credentials, subscribe to events, and start recognition.
final recognizer = SORIAudioRecognizer(
applicationId: 'your-application-id',
secretKey: 'your-secret-key',
);
await recognizer.configure();
recognizer.events.listen((event) {
final campaign = event.campaign;
if (campaign != null) {
// Render campaign.name, campaign.imageUrl, and campaign.actionUrl.
}
});
await recognizer.startRecognition(
notification: const SORIAndroidNotificationOptions(
title: 'Listening',
body: 'SORI audio recognition is active',
),
);
When a user taps a campaign action URL that your app has decided to open, report that interaction back to SORI:
final actionUrl = campaign.actionUrl;
if (actionUrl != null && actionUrl.isNotEmpty) {
await recognizer.handleActionUrl(actionUrl);
}
App Requirements
Android permissions and the foreground microphone service declaration are merged
from the plugin. On Android, startRecognition() requests runtime microphone
permission when needed and continues the same start request after permission is
granted. On Android 13 and later, request notification permission if your app
targets that API level and you want the foreground-service notification to be
shown normally.
iOS apps must add NSMicrophoneUsageDescription to Info.plist. Add
UIBackgroundModes with audio only if the app is designed to continue
recognition while backgrounded.
Do not ship SORI credentials in sample or public source. Create and rotate app keys in SORI Console, and load them through your app's normal release configuration process.
Notes
The plugin exposes recognition lifecycle, campaign/result/error events, database
updates, and an explicit handleActionUrl() method for URLs that your app has
inspected. Location, metadata provider, raw audio buffers, and automatic action
URL opening are not part of the public Flutter API.
See the example/ app for a complete recognition flow that reads credentials
from --dart-define values and renders recognized campaigns.