Quick Start
Get up and running with Abrova Push — Flutter, Android, iOS, React Native, Web. Install from Abrova Center, initialize, register, listen, subscribe to topics, send a test notification.
Get up and running with Abrova Push in minutes. Pick your platform: every SDK installs from Abrova Center, and every app uses only your public project key (ab_live_…).
Abrova Push delivers to Android over its own persistent connection (TLS, port 443), so it reaches phones without Google Play services, including Huawei. An optional FCM bridge can add Firebase where it is available. iOS uses APNs, and browsers use Web Push.
10,000 messages a month are free. The price above that is set when Abrova Push launches.
Using an AI assistant? See AI assistants for what works today.
Flutter#
1. Add Dependency
Add the package to pubspec.yaml from Abrova Center, then run flutter pub get:
dependencies:
abrova_push:
hosted: https://center.abrova.ir/api/packages/abrova/pub
version: ^0.1.20The plugin uses the native SDKs. Add the Abrova Center repository to android/build.gradle, and the iOS SDK to ios/Podfile (see Flutter SDK for details):
maven { url "https://center.abrova.ir/api/packages/abrova/maven" }pod 'AbrovaPushSDK', :git => 'https://github.com/Abrova-co/abrova-push-ios-sdk.git', :tag => '0.1.16'
2. Initialize SDK
import 'package:abrova_push/abrova_push.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await AbrovaPush.init(AbrovaPushConfig(
apiKey: 'ab_live_your_api_key',
));
runApp(MyApp());
}3. Register & Listen
@override
void initState() {
super.initState();
// Listen for messages
AbrovaPush.onMessage((message) {
print('Title: ${message.title}');
print('Body: ${message.body}');
print('Data: ${message.data}');
});
// Connection status
AbrovaPush.onConnectionState((connected) {
print(connected ? 'Connected' : 'Disconnected');
});
// Register device
AbrovaPush.register(userId: 'user_123');
}Android Platform Setup
Add permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
iOS Platform Setup
- Enable Push Notifications capability in Xcode
- Enable Background Modes → Remote notifications
- For VoIP Push, enable Voice over IP in Background Modes
Android#
1. Add Dependency
Add the Abrova Center repository to settings.gradle.kts:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://center.abrova.ir/api/packages/abrova/maven") }
}
}Then add the dependency to build.gradle.kts (app level):
dependencies {
implementation("ir.abrova:abrova-push-android:0.1.15")
}2. Add Permissions
Add to AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
3. Initialize SDK
import ir.abrova.push.sdk.AbrovaPush
import ir.abrova.push.sdk.AbrovaPushConfig
// In your Application class or MainActivity
AbrovaPush.init(
applicationContext,
AbrovaPushConfig(apiKey = "ab_live_your_api_key"),
)4. Register & Listen
import ir.abrova.push.sdk.AbrovaPushCallbackAdapter
import ir.abrova.push.sdk.AbrovaPushError
import ir.abrova.push.sdk.AbrovaPushMessage
AbrovaPush.setCallback(object : AbrovaPushCallbackAdapter() {
override fun onMessageReceived(message: AbrovaPushMessage) {
// message.title, message.body, message.data
}
override fun onConnectionStateChanged(connected: Boolean) {
// true / false
}
override fun onRegistered(deviceId: String) {
// Device registered
}
override fun onDetailedError(error: AbrovaPushError) {
// error.code, error.message
}
})
// Call on every app launch: keeps the device's token, app version
// and last-seen time current on the server
AbrovaPush.register(userId = "user_123")5. Topic Subscription
AbrovaPush.subscribeTopic("news")
AbrovaPush.subscribeTopic("promotions")
AbrovaPush.unsubscribeTopic("promotions")The Android SDK uses a foreground service for reliable message delivery. Users will see a persistent notification while the service is running, unless you set showServiceNotification = false in AbrovaPushConfig.
iOS#
1. Add Dependency
In Xcode: File → Add Packages… → enter https://github.com/Abrova-co/abrova-push-ios-sdk.git
Choose version 0.1.16 or later. Or in Package.swift:
dependencies: [
.package(url: "https://github.com/Abrova-co/abrova-push-ios-sdk.git", from: "0.1.16")
]2. Configure Capabilities
In Xcode, enable:
- Push Notifications
- Background Modes → Remote notifications
- Background Modes → Voice over IP (optional, for VoIP push)
3. Initialize SDK
import AbrovaPush
// In AppDelegate didFinishLaunchingWithOptions
AbrovaPush.shared.initialize(
config: AbrovaPushConfig(apiKey: "ab_live_your_api_key")
)
AbrovaPush.shared.delegate = self
// Forward the APNs token
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
AbrovaPush.shared.setAPNsToken(deviceToken)
}4. Register & Listen
extension AppDelegate: AbrovaPushDelegate {
func abrovaPush(_ abrovaPush: AbrovaPush, didReceiveMessage message: AbrovaPushMessage) {
// message.title, message.body, message.data
}
func abrovaPush(_ abrovaPush: AbrovaPush, didChangeConnectionState connected: Bool) {
// true / false
}
func abrovaPush(_ abrovaPush: AbrovaPush, didRegisterWithDeviceId deviceId: String) {
// Device registered
}
func abrovaPush(_ abrovaPush: AbrovaPush, didFailWithError error: Error) {
// Connection or registration error
}
}
// Call on every app launch, with an optional user ID
AbrovaPush.shared.register(userId: "user_123")5. Topic Subscription
AbrovaPush.shared.subscribeTopic("news")
AbrovaPush.shared.subscribeTopic("promotions")
AbrovaPush.shared.unsubscribeTopic("promotions")iOS requires user permission for notifications. The SDK automatically requests permission during registration.
React Native#
1. Install Package
Install the package from Abrova Center (it has no dependencies of its own):
npm install abrova-push-react-native --registry=https://center.abrova.ir/api/packages/abrova/npm/
The package uses the native SDKs: add the Abrova Center Maven repository and the iOS Podfile line exactly as for Flutter above (see React Native SDK).
2. Initialize SDK
import AbrovaPush from 'abrova-push-react-native';
await AbrovaPush.init({ apiKey: 'ab_live_your_api_key' });3. Register & Listen
// Listen for messages
const unsubscribe = AbrovaPush.onMessage((message) => {
console.log('Title:', message.title);
console.log('Body:', message.body);
console.log('Data:', message.data);
});
// Register device
await AbrovaPush.register({ userId: 'user_123' });
// Don't forget to unsubscribe when component unmounts
// unsubscribe();Android Platform Setup
Add to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
iOS Platform Setup
- Enable Push Notifications capability in Xcode
- Enable Background Modes → Remote notifications
- For VoIP Push, enable Voice over IP in Background Modes
Web#
1. Install SDK
Point the @abrova scope at Abrova Center in your project's .npmrc, then install:
# .npmrc @abrova:registry=https://center.abrova.ir/api/packages/abrova/npm/
npm install @abrova/push-web
2. Add Service Worker
Create public/abrova-push-sw.js for background push notifications:
cp node_modules/@abrova/push-web/service-worker.js public/abrova-push-sw.js
Copy the service worker again whenever you upgrade the SDK.
3. Initialize SDK
import AbrovaPush from '@abrova/push-web';
// Create AbrovaPush instance - only apiKey is required
const abrovaPush = new AbrovaPush({
apiKey: 'ab_live_your_api_key',
serviceWorkerPath: '/abrova-push-sw.js', // optional, default path
});4. Set Up Callbacks
// Message received (foreground)
abrovaPush.onMessage((message) => {
console.log('Title:', message.title);
console.log('Body:', message.body);
console.log('Data:', message.data);
});
// Connection state changes
abrovaPush.onConnectionState((state) => {
console.log('Connection:', state); // 'connecting' | 'connected' | 'disconnected' | 'error'
});
// Registration success
abrovaPush.onRegistered((deviceId) => {
console.log('Device registered:', deviceId);
});
// Notification clicked (from background)
abrovaPush.onNotificationClick((message, action) => {
console.log('Notification clicked:', message.title);
if (message.deepLink) {
window.location.href = message.deepLink;
}
});
// Error handling with detailed error codes
abrovaPush.onDetailedError((error) => {
console.error(`Error [${error.code}]: ${error.message}`, error.details);
});5. Register Device
// Register device - requests notification permission automatically
// This also sets up Web Push for background notifications.
// Once permission is granted, call register() on every page load.
try {
const deviceId = await abrovaPush.register({ userId: 'user_123' });
console.log('Registered with device ID:', deviceId);
} catch (error) {
if (error.code === 1600) {
console.log('User denied notification permission');
}
}6. Topic Subscription
// Subscribe to topics
await abrovaPush.subscribeTopic('news');
await abrovaPush.subscribeTopic('promotions');
// Unsubscribe
await abrovaPush.unsubscribeTopic('promotions');Complete HTML Example
<!DOCTYPE html>
<html>
<head>
<title>AbrovaPush Web Demo</title>
</head>
<body>
<h1>AbrovaPush Web Push Demo</h1>
<button id="registerBtn">Enable Notifications</button>
<div id="status"></div>
<!-- copied from node_modules/@abrova/push-web/dist/index.umd.js -->
<script src="/abrova-push.umd.js"></script>
<script>
const abrovaPush = new AbrovaPush.default({
apiKey: 'ab_live_your_api_key'
});
// Set up callbacks
abrovaPush.onMessage((msg) => {
document.getElementById('status').innerHTML =
'<strong>' + msg.title + '</strong><br>' + msg.body;
});
abrovaPush.onConnectionState((state) => {
console.log('Connection:', state);
});
// Register on button click
document.getElementById('registerBtn').onclick = async () => {
try {
const deviceId = await abrovaPush.register();
document.getElementById('status').textContent = 'Registered: ' + deviceId;
} catch (e) {
document.getElementById('status').textContent = 'Error: ' + e.message;
}
};
</script>
</body>
</html>The SDK automatically sets up Web Push notifications using VAPID keys. This enables background notifications even when the browser is closed.
- HTTPS required (localhost works for development)
- Service worker file must be in public root directory
- Safari on iOS does not support Web Push (Safari on macOS does)
Send a Test Notification#
Send from Abrova Console (Push → Send), or from your server with the server secret (ab_srv_…, kept in an environment variable, never in an app):
curl -X POST "https://push-api.abrova.ir/push/send-to-user" \
-H "x-api-key: ab_live_your_api_key" \
-H "x-server-secret: $ABROVA_SERVER_SECRET" \
-H "Content-Type: application/json" \
-d '{ "userId": "user_123", "title": "Hello", "body": "Your first Abrova push" }'Templates support variables and Farsi / English versions of the same message. See Send push for every target, and Node.js SDK for the server SDK.