Mobile SDK Reference
Request the notification permission and register a subscribed device.
Java
Kotlin
Swift
Objective-C
Dart
JavaScript
/*
Params
- Context context
- String projectId
*/
FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID");
/*
Params
- Context context
- String projectId
*/
FlareLane.initWithContext(this, "INPUT_YOUR_PROJECT_ID")
/*
Params
- launchOptions: [UIApplication.LaunchOptionsKey : Any]?
- projectId: String
*/
FlareLane.initWithLaunchOptions(launchOptions, projectId: "INPUT_YOUR_PROJECT_ID")
/*
Params
- launchOptions:(NSDictionary<UIApplicationLaunchOptionsKey,id> * _Nullable)
- projectId:(NSString * _Nonnull)
*/
[FlareLane initWithLaunchOptions:launchOptions projectId:@"INPUT_YOUR_PROJECT_ID"];
/*
Params
- String projectId
*/
FlareLane.shared.initialize("INPUT_YOUR_PROJECT_ID");
/*
Params
- projectId: string
*/
FlareLane.initialize('INPUT_YOUR_PROJECT_ID');
Java
Kotlin
Swift
Objective-C
Dart
JavaScript
/*
Params
- int logLevel
- Log.VERBOSE
- Log.ERROR
*/
FlareLane.setLogLevel(Log.VERBOSE);
/*
Params
- int logLevel
- Log.VERBOSE
- Log.ERROR
*/
FlareLane.setLogLevel(Log.VERBOSE)
/*
Params
- LogLevel level
- .verbose
- .error
*/
FlareLane.setLogLevel(level: .verbose)
/*
Params
- LogLevel level
- LogLevelVerbose
- LogLevelError
*/
[FlareLane setLogLevelWithLevel:LogLevelVerbose];
/*
Params
- LogLevel logLevel
- LogLevel.verbose
- LogLevel.error
*/
FlareLane.shared.setLogLevel(LogLevel.verbose);
/*
Params
- logLevel: LogLevel
- 'verbose'
- 'error'
*/
FlareLane.setLogLevel('verbose');
Use if you want to manage subscriptions directly within your app.
Java
Kotlin
Swift
Objective-C
Dart
JavaScript
/*
Params
- Context context
- boolean isSubscribed
*/
FlareLane.setIsSubscribed(this, true);
/*
Params
- Context context
- boolean isSubscribed
*/
FlareLane.setIsSubscribed(this, true)
/*
Params
- isSubscribed: Bool
*/
FlareLane.setIsSubscribed(isSubscribed: true)
/*
Params
- isSubscribed: BOOL
*/
[FlareLane setIsSubscribedWithIsSubscribed: YES];
/*
Params
- bool isSubscribed
*/
FlareLane.shared.setIsSubscribed(true);
/*
Params
- isSubscribed: boolean
*/
FlareLane.setIsSubscribed(true);
When logging in, specify the user ID.
Java
Kotlin
Swift
Objective-C
Dart
JavaScript
/*
Params
- Context context
- @Nullable String userId
*/
// SET
FlareLane.setUserId(this, "[email protected]");
// REMOVE
FlareLane.setUserId(this, null);
/*
Params
- Context context
- @Nullable String userId
*/
// SET
FlareLane.setUserId(this, "[email protected]")
// REMOVE
FlareLane.setUserId(this, null)
/*
Params
- userId: String?
*/
// SET
FlareLane.setUserId(userId: "[email protected]")
// REMOVE
FlareLane.setUserId(this, nil)
/*
Params
- userId:(NSString * _Nullable)
*/
// SET
[FlareLane setUserIdWithUserId: @"[email protected]"];
// REMOVE
[FlareLane setUserIdWithUserId: nil];
/*
Params
- String? userId
*/
// SET
FlareLane.shared.setUserId("[email protected]");
// REMOVE
FlareLane.shared.setUserId(null);
/*
Params
- userId: string | null
*/
// SET
FlareLane.setUserId("[email protected]");
// REMOVE
FlareLane.setUserId(null);
Java
Kotlin
Swift
Objective-C
Dart
JavaScript
/*
Params
- Context context
- JSONObject tags
*/
try {
JSONObject tags = new JSONObject();
tags.put("gender", "men");
tags.put("age", 24);
FlareLane.setTags(this, tags);
} catch (JSONException e) {
e.printStackTrace();
}
/*
Params
- Context context
- JSONObject tags
*/
var tags = JSONObject()
tags.put("gender", "men")
tags.put("age", 24)
FlareLane.setTags(this, tags)
/*
Params
- tags: [String : Any]
*/
FlareLane.setTags(tags: ["gender": "men", "age": 24])
/*
Params
- tags:(NSDictionary<NSString *,id> * _Nonnull)
*/
[FlareLane setTagsWithTags:@{@"gender": @"men", @"age": @24}];
/*
Params
- Map<String, Object> tags
*/
FlareLane.shared.setTags({
"gender": "men",
"age": 24
});
/*
Params
- tags: Record<string, any>
*/
FlareLane.setTags({ gender: 'men', age: 27 });
Java
Kotlin
Swift
Objective-C
Dart
JavaScript
/*
Params
- Context context
*/
FlareLane.getDeviceId(this);
/*
Params
- Context context
*/
FlareLane.getDeviceId(this);
FlareLane.getDeviceId()
[FlareLane getDeviceId];
await FlareLane.shared.getDeviceId())
await FlareLane.getDeviceId()
Register a callback handler to be executed when the app enters after clicking on the notification.
Java
Kotlin
Swift
Objective-C
Dart
JavaScript
/*
Params
- public interface NotificationConvertedHandler
- onConverted(Notification notification)
- Notification
- @NonNull String id
- @Nullable String title
- @NonNull String body
- @Nullable String url
- @Nullable String imageUrl
*/
FlareLane.setNotificationConvertedHandler(new NotificationConvertedHandler() {
@Override
public void onConverted(Notification notification) {
Log.d("FlareLaneTest", notification.toString());
}
});
/*
Params
- public interface NotificationConvertedHandler
- onConverted(Notification notification)
- Notification
- @NonNull String id
- @Nullable String title
- @NonNull String body
- @Nullable String url
- @Nullable String imageUrl
*/
FlareLane.setNotificationConvertedHandler(NotificationConvertedHandler { notification ->
Log.d("FlareLaneTest", notification.toString())
})
/*
Params
- callback: (FlareLaneNotification) -> Void
- FlareLaneNotification
- id: String
- body: String
- title: String?
- url: String?
- imageUrl: String?
*/
FlareLane.setNotificationConvertedHandler() { notification in
print(notification);
}
/*
Params
- callback: (FlareLaneNotification) -> Void
- FlareLaneNotification
- id: String
- body: String
- title: String?
- url: String?
- imageUrl: String?
*/
[FlareLane setNotificationConvertedHandlerWithCallback:^(FlareLaneNotification* _Nonnull notification) {
// Do something..
}];
/*
Params
- NotificationConvertedHandler handler = void Function(FlareLaneNotification notification);
- FlareLaneNotification
- String id
- String? title
- String body
- String? url
- String? imageUrl
*/
FlareLane.shared.setNotificationConvertedHandler((notification) {
print(notification);
});
/*
Params
- callback: (notification: Notification) => undefined
- Notification
- id: string;
- title?: string;
- body: string;
- url?: string;
*/
FlareLane.setNotificationConvertedHandler((notification) => {
console.log(notification)
});