Repro - Mobile Analytics for growth
日本語
Sign Up Back to Dashboard
  • System Requirements
  • Dashboard Guide
  • Development Guide
    • Signup
    • iOS/Android SDK
      • Get Started
      • Session Lifecycle
      • User ID
      • Device ID
      • User Profile
      • Event Tracking
      • Push Notification
      • NewsFeed
        • The specifications of newsfeed
          • Maximum fetched campaigns per request
          • The available period newsfeed
        • Newsfeed’s interfaces
          • Data formats
          • Fetch newsfeed
          • Update newsfeed
      • In-App Message
      • Silver Egg Recommendation Messages
      • Remote Config
      • WebView
      • Opt-out feature
      • Settings regarding the collection of advertiser IDs
      • Registering an user device into a specific audience with the help of a QR code
      • Set attribution data from Adjust to Repro
      • Set attribution data from AppsFlyer to Repro
      • Log Level
      • Verification Method
    • Web
    • Audience API
    • Audience Import(β)
    • Push API
    • User Profile API
    • User Profile Bulk Import
    • NewsFeed API
    • Deletion Targeted User Registration API
    • Booster installation guide
    • Mail(β)
  • Release Notes
  • FAQ

NewsFeed¶

By using the news feed, it is possible to retrieve push notifications (created in standard format), in-app messages and web message history.

The specifications of newsfeed¶

Maximum fetched campaigns per request¶

You can fetch 200 recent campaigns at the maximum per request. If you want to get more than 200 campaigns, please use the ID of the tail element of the response as a parameter of Using offsets and re-fetch.

Warning

In order to get the history of push notification campaigns via the NewsFeeds feature, you need to use one of the following SDKs.

  • Android SDK 5.0.1 and over.

  • iOS SDK 4.8.0 and over.

  • Unity SDK 6.0.0 and over.

  • React Native SDK 3.0.0 and over.

  • Cordova Plugin 6.0.0 and over.

  • Cocos2d-x SDK 5.0.0 and over.

  • Flutter Package 1.0.0 and over.

In addition, to retrieve the history of In-App messages and web messages, one of the following SDKs is required.

  • Android SDK 5.6.0 and over.

  • iOS SDK 5.8.0 and over.

  • Unity SDK 6.7.0 and over.

  • React Native SDK 3.7.0 and over.

  • Cordova Plugin 6.7.0 and over.

  • Cocos2d-x SDK 5.7.0 and over.

  • Flutter Package 2.0.0 and over.

Warning

In order to use the NewsFeeds feature, your campaign must be created as follows

  1. The campaign must be created in standard format. (For Push Notifications)

  2. Check “Allow push notification to be used in a newsfeed” when you create the campaign.

Warning

If the campaign is in custom JSON format or specifies Push API, you can’t use it as a newsfeed.

The available period newsfeed¶

You can get the campaigns within 30 days from the day the request happens.

Newsfeed’s interfaces¶

Data formats¶

The data format of newsfeed is the following:

public class NewsFeedEntry {

    public final long id;
    public final NewsFeedCampaignType campaignType;
    public final String deviceID;
    public final String title;
    public final String summary;
    public final String body;
    public final Uri linkUrl;                         // Deprecated
    public final String linkUrlString;
    public final Uri imageUrl;                        // Deprecated
    public final String imageUrlString;
    public final Date deliveredAt;
    public boolean shown;
    public boolean read;

    public NewsFeed(JSONObject json);
}
@interface RPRNewsFeedEntry : NSObject

@property (nonatomic, readonly)           uint64_t ID;
@property (nonatomic, readonly)           NSString *deviceID;
@property (nonatomic, readonly)           NSString *title;
@property (nonatomic, readonly)           NSString *summary;
@property (nonatomic, readonly)           NSString *body;
@property (nonatomic, readonly)           RPRCampaignType campaignType;
@property (nonatomic, readonly, nullable) NSURL *linkUrl;                // Deprecated
@property (nonatomic, readonly)           NSString *linkUrlString;
@property (nonatomic, readonly, nullable) NSURL *imageUrl;               // Deprecated
@property (nonatomic, readonly)           NSString *imageUrlString;
@property (nonatomic, readonly)           NSDate *deliveredAt;
@property (nonatomic)                     BOOL shown;
@property (nonatomic)                     BOOL read;

@end
class RPRNewsFeedEntry: NSObject {
    private(set) var ID: UInt64
    private(set) var deviceID: String?
    private(set) var title: String?
    private(set) var summary: String?
    private(set) var body: String?
    private(set) var campaignType: RPRCampaignType
    private(set) var linkUrl: URL?                    // Deprecated
    private(set) var linkUrlString: String?
    private(set) var imageUrl: URL?                   // Deprecated
    private(set) var imageUrlString: String?
    private(set) var deliveredAt: Date?
    var shown = false
    var read = false
}
class ReproCpp {

public:

    class NewsFeedEntry {

    public:

        uint64_t getID();
        const char * getDeviceID();
        const char * getTitle();
        const char * getSummary();
        const char * getBody();
        ReproCpp::CampaignType getCampaignType();
        const char * getLinkUrl();                   // Deprecated
        const char * getLinkUrlString();
        const char * getImageUrl();                  // Deprecated
        const char * getImageUrlString();
        time_t getDeliveredAt();
        bool getShown();
        bool getRead();
        void setShown(bool value);
        void setRead(bool value);
    };
};
public class NewsFeedEntry
{
    public long Id { get; }
    public NewsFeedCampaignType CampaignType { get; }
    public string DeviceID { get; }
    public string Title { get; }
    public string Summary { get; }
    public string Body { get; }
    public Uri LinkUrl { get; }                        // Deprecated
    public string LinkUrlString { get; }
    public Uri ImageUrl { get; }                       // Deprecated
    public string ImageUrlString { get; }
    public DateTime DeliveredAt { get; }
    public bool Shown { get; set; }
    public bool Read { get; set; }
    public Dictionary<string, string> Extras { get; }
}
class NewsFeedEntry {
    constructor(value) {
        this.id; // number
        this.deviceID; // string
        this.title; // string
        this.summary; // string
        this.body; // string
        this.campaignType; // integer
        this.deliveredAt; // string
        this.linkUrl; // Deprecated
        this.linkUrlString; // string
        this.imageUrl; // Deprecated
        this.imageUrlString; // string
        this.shown; // boolean
        this.read; // boolean
    }
}
/**
* @property {number}       newsfeed_id      - The newsfeed id
* @property {string}       device_id        - The end user's device id
* @property {string}       title            - The campaign's title
* @property {string}       summary          - The campaign's summary
* @property {string}       body             - The campaign's body
* @property {string}       delivered_at     - The campaign's delivered date time
* @property {string}       link_url         - Deprecated
* @property {string}       link_url_string  - The campaign's link url
* @property {string}       image_url        - Deprecated
* @property {string}       image_url_string - The campaign's image url
* @property {string}       campaign_type    - The campaign's type("in_app_message" or "web_message" or "push_notification" or "all")
* @property {boolean}      shown            - Indicate whether the newsfeed has been shown to end user
* @property {boolean}      read             - Indicate whether the newsfeed has been read by end user
*/

{
    "newsfeed_id":      1,
    "device_id":        "123456789",
    "title":            "The title",
    "summary":          "The summary",
    "body":             "The body",
    "delivered_at":     "XXXX-XX-XXTXX:XX:XX+XX:XXXX",
    "link_url":         "https://example.com",
    "link_url_string":  "https://example.com",
    "image_url":        "https://example.com/example.jpeg",
    "image_url_string": "https://example.com/example.jpeg",
    "campaign_type":    "in_app_message",
    "shown":            true,
    "read":             false
}
// For Flutter Package below version 3.0.0
class NewsFeedEntry {
    int get id;
    NewsFeedCampaignType get campaignType;
    String get deviceID;
    String get title;
    String get summary;
    String get body;
    String get linkUrl;       // Deprecated
    String get linkUrlString;
    String get imageUrl;      // Deprecated
    String get imageUrlString;
    DateTime get deliveredAt; // UTC Date
    String get rawDeliveredAt;

// For Flutter Package version 3.0.0 and above
class NewsFeedEntry {
    int get id;
    NewsFeedCampaignType get campaignType;
    String get deviceID;
    String get title;
    String get summary;
    String get body;
    String? get linkUrl;       // Deprecated
    String? get linkUrlString;
    String? get imageUrl;      // Deprecated
    String? get imageUrlString;
    DateTime? get deliveredAt; // UTC Date
    String? get rawDeliveredAt;
    bool shown;
    bool read;
}

Warning

The parameters link_url and image_url are deprecated. Please use link_url_string and image_url_string which provide the same data as a normal string.

  • The reason for this change is that depending on how the initial URL string was provided, URLs containing multibyte characters could not always be converted to the correct system type for URLs (e.g. NSURL).

The parameters link_url_string and image_url_string are only available with the SDK versions listed below.

  • Android SDK 5.16.0 and over.

  • iOS SDK 5.17.0 and over.

  • Unity SDK 6.18.0 and over.

  • React Native SDK 3.19.0 and over.

  • Cordova Plugin 6.19.0 and over.

  • Cocos2d-x SDK 5.18.0 and over.

  • Flutter Package 3.10.0 and over.

link_url_string image_url_string is set to a string or an empty string.

If link_url is not set, null will be set as the return value, but campaign created before 2022/03/08 may return empty characters.

In addition, the values that can be specified as campaign types are in the following data formats.

public enum NewsFeedCampaignType {
    PushNotification,
    InAppMessage,
    WebMessage,
    All
}
typedef NS_ENUM(NSUInteger, RPRCampaignType) {
    RPRCampaignTypePushNotification,
    RPRCampaignTypeInAppMessage,
    RPRCampaignTypeWebMessage,
    RPRCampaignTypeAll
};
enum RPRCampaignType {
    case pushNotification
    case inAppMessage
    case webMessage
    case all
}
enum class CampaignType : uint64_t {
    PushNotification,
    InAppMessage,
    WebMessage,
    All,
};
public enum NewsFeedCampaignType
{
    PushNotification,
    InAppMessage,
    WebMessage,
    All
}
Repro.CAMPAIGN_TYPE_PUSH_NOTIFICATION;
Repro.CAMPAIGN_TYPE_IN_APP_MESSAGE;
Repro.CAMPAIGN_TYPE_WEB_MESSAGE;
Repro.CAMPAIGN_TYPE_ALL;
Repro.CampaignType.InAppMessage
Repro.CampaignType.PushNotification
Repro.CampaignType.WebMessage
Repro.CampaignType.All
enum NewsFeedCampaignType {
    PushNotification,
    InAppMessage,
    WebMessage,
    All
}

Warning

The values in the campaignType fields can only be obtained if you are using the following SDKs.

  • Android SDK 5.6.0 and over.

  • iOS SDK 5.8.0 and over.

  • Unity SDK 6.7.0 and over.

  • React Native SDK 3.7.0 and over.

  • Cordova Plugin 6.7.0 and over.

  • Cocos2d-x SDK 5.7.0 and over.

  • Flutter Package 2.0.0 and over.

Fetch newsfeed¶

Interfaces¶

public final class Repro {
    // Android SDK 5.0.1 or later
    public static List<NewsFeedEntry> getNewsFeeds(final int limit) throws IOException, RuntimeException;
    public static List<NewsFeedEntry> getNewsFeeds(final int limit, final long offsetID) throws IOException, RuntimeException;

    // Only for Android SDK 5.6.0 or later
    public static List<NewsFeedEntry> getNewsFeeds(final int limit, final NewsFeedCampaignType campaignType) throws IOException, RuntimeException;
    public static List<NewsFeedEntry> getNewsFeeds(final int limit, final long offsetID, final NewsFeedCampaignType campaignType) throws IOException, RuntimeException;
}
@interface Repro : NSObject

// iOS SDK 4.8.0 or later
+ (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
                                                 error:(NSError * _Nullable * _Nullable)error
+ (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
                                              offsetID:(uint64_t)offsetID
                                                 error:(NSError * _Nullable * _Nullable)error

// Only iOS SDK 5.8.0 or later
+ (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
                                          campaignType:(RPRCampaignType)campaignType
                                                 error:(NSError * _Nullable * _Nullable)error
+ (nullable NSArray<RPRNewsFeedEntry *> *)getNewsFeeds:(uint64_t)limit
                                              offsetID:(uint64_t)offsetID
                                          campaignType:(RPRCampaignType)campaignType
                                                 error:(NSError * _Nullable * _Nullable)error

@end
class Repro: NSObject {
    // iOS SDK 4.8.0 or later
    class func getNewsFeeds(_ limit: UInt64) throws -> [RPRNewsFeedEntry]?
    class func getNewsFeeds(_ limit: UInt64, offsetID: UInt64) throws -> [RPRNewsFeedEntry]?

    // Only iOS SDK 5.8.0 or later
    class func getNewsFeeds(_ limit: UInt64, campaignType: RPRCampaignType) throws -> [RPRNewsFeedEntry]?
    class func getNewsFeeds(_ limit: UInt64, offsetID: UInt64, campaignType: RPRCampaignType) throws -> [RPRNewsFeedEntry]?
}
class ReproCpp {

public:

    // Cocos2d-x SDK 5.0.0 or later
    static std::vector<ReproCpp::NewsFeedEntry> getNewsFeeds(uint64_t limit, bool *error);
    static std::vector<ReproCpp::NewsFeedEntry> getNewsFeeds(uint64_t limit, uint64_t offsetID, bool *error);

    // Only Cocos2d-x SDK 5.7.0 or later
    static std::vector<ReproCpp::NewsFeedEntry> getNewsFeeds(uint64_t limit, ReproCpp::CampaignType campaignType, bool *error);
    static std::vector<ReproCpp::NewsFeedEntry> getNewsFeeds(uint64_t limit, uint64_t offsetID, ReproCpp::CampaignType campaignType, bool *error);
};
public class Repro
{
    // Unity SDK 6.0.0—6.6.0
    public static List<NewsFeedEntry> GetNewsFeeds(int limit);
    public static List<NewsFeedEntry> GetNewsFeeds(int limit, long offsetID);

    // Unity SDK 6.7.0 or later
    public static List<NewsFeedEntry> GetNewsFeeds(int limit, NewsFeedCampaignType campaignType = NewsFeedCampaignType.PushNotification);
    public static List<NewsFeedEntry> GetNewsFeeds(int limit, long offsetID, NewsFeedCampaignType campaignType = NewsFeedCampaignType.PushNotification);
}
const Repro = {
    // React Native SDK 3.0.0 or later
    getNewsFeeds: (limit, callback) => void,
    getNewsFeedsFor: (limit, offsetID, callback) => void,

    // Only React Native SDK 3.7.0 or later
    getNewsFeedsWithCampaignType: (limit, campaignType, callback) => void,
    getNewsFeedsWithCampaignTypeFor: (limit, offsetID, campaignType, callback) => void,
}
const Repro = {
    // Cordova Plugin 6.0.0 or later
    getNewsFeedsWithLimit: (limit, successCallback, errorCallback) => void,
    getNewsFeedsWithLimitAndOffsetId: (limit, offsetId, successCallback, errorCallback) => void,

    // Cordova Plugin 6.7.0 or later
    getNewsFeedsWithLimitAndCampaignType: (limit, campaignType, successCallback, errorCallback) => void,
    getNewsFeedsWithLimitAndOffsetIdAndCampaignType: (limit, offsetId, campaignType, successCallback, errorCallback) => void
}
class Repro {
    // Flutter Package version 1.X.X
    static Future<List<NewsFeedEntry>> getNewsFeeds(int limit, [int offsetID])

    // Flutter Package version 2.X.X
    static Future<List<NewsFeedEntry>> getNewsFeeds({ @required int limit, int offsetID, @required NewsFeedCampaignType campaignType })

    // Flutter Package version 3.X.X
    static Future<List<NewsFeedEntry>> getNewsFeeds({ required int limit, int? offsetID, required NewsFeedCampaignType campaignType })
}

Warning

The methods that can be used depend on the version of the SDK you are using.

Warning

If you execute a method without specifying the campaign types ( campaignType ), only the history of push notifications will be retrieved, regardless of the version of the SDK you are using.

Example of the implementation to fetch the last 20 campaigns.¶

The following is an example of the implementation to fetch the last 20 campaigns as a newsfeed.

new Thread(new Runnable() {
    @Override
    public void run() {
        // Get 20 campaigns as a newsfeed
        List<NewsFeedEntry> newsFeedEntries;
        try {
            // Android SDK 5.0.1 or later
            // (Get only push notification histories)
            newsFeedEntries = Repro.getNewsFeeds(20);

            // Android SDK 5.6.0 or later
            newsFeedEntries = Repro.getNewsFeeds(20, NewsFeedCampaignType.PushNotification);
        } catch (IOException e) {
            // Error handling
            ...
        } catch (RuntimeException e) {
            // Error handling
            ...
        }
    }
}).start();
...

// iOS SDK 4.8.0 or later
NSError *error = nil;
NSArray<RPRNewsFeedEntry *> *newsFeeds = [Repro getNewsFeeds:20 error:&error];
if (error) {
    // Error handling
}

// iOS SDK 5.8.0 or later
NSError *error = nil;
NSArray<RPRNewsFeedEntry *> *newsFeedEntries = [Repro getNewsFeeds:20
                                                      campaignType:RPRCampaignTypePushNotification
                                                             error:&error];
if (error) {
    // Error handling
}

...
...

// iOS SDK 4.8.0 or later
var newsFeeds: [RPRNewsFeedEntry]?
do {
    newsFeeds = try Repro.getNewsFeeds(20)
} catch {
    // Error handling
}

// iOS SDK 5.8.0 or later
var newsFeeds: [RPRNewsFeedEntry]?
do {
    newsFeeds = try Repro.getNewsFeeds(20, campaignType: .pushNotification)
} catch {
    // Error handling
}

...
...

// Cocos2d-x SDK 5.0.0 or later
bool error;
std::vector<ReproCpp::NewsFeedEntry> newsFeeds = ReproCpp::getNewsFeeds(20, &error);
if (error) {
    // Error handling
}

// Cocos2d-x SDK 5.7.0 or later
bool error;
std::vector<ReproCpp::NewsFeedEntry> newsFeeds = ReproCpp::getNewsFeeds(20, ReproCpp::CampaignType::PushNotification, &error);
if (error) {
    // Error handling
}

...
...

// Get only push notification histories
var newsFeedEntries = Repro.GetNewsFeeds(20);

// Unity SDK 6.7.0 or later
var newsFeedEntries = Repro.GetNewsFeeds(20, NewsFeedCampaignType.PushNotification);

...
...

// React Native SDK 3.0.0 or later
Repro.getNewsFeeds(20, (_, newsFeeds) => {
    ...
});

// React Native SDK 3.7.0 or later
Repro.getNewsFeedsWithCampaignType(20, Repro.CAMPAIGN_TYPE_PUSH_NOTIFICATION, (_, newsFeeds) => {
    ...
});

...
...

// Cordova Plugin 6.0.0 or later
Repro.getNewsFeedsWithLimit(
    20,
    (newsFeeds) => {
        ...
    },
    (error) => {
        // Error handling
    }
);

// Cordova Plugin 6.7.0 or later
Repro.getNewsFeedsWithLimitAndCampaignType(
    20,
    Repro.CampaignType.InAppMessage,
    (newsFeeds) => {
        ...
    },
    (error) => {
        // Error handling
    }
);

...
...

// Flutter Package 1.0.0—1.6.0
final newsfeeds = await Repro.getNewsFeeds(20);

// Flutter Package 2.0.0 or later
final newsfeeds = await Repro.getNewsFeeds(limit: 20, campaignType: NewsFeedCampaignType.PushNotification)

...

The example of the implementation to fetch the 20 campaigns which are after a campaign with using offset¶

The following is an example of the implementation to fetch 20 campaigns after a campaign, whose ID is 1111, as a newsfeed with using offset.

new Thread(new Runnable() {
    @Override
    public void run() {
        // Get 20 campaigns as a newsfeed
        List<NewsFeedEntry> newsFeedEntries;
        try {
            // Get the ID of the last item (1111)
            List<NewsFeedEntry> feeds = Repro.getNewsFeeds(20);
            long lastItemId = feeds.get(feeds.size() - 1).id; // 1111

            // Android SDK 5.0.1 or later
            // (Get only push notification histories)
            newsFeedEntries = Repro.getNewsFeeds(20, lastItemId);

            // Android SDK 5.6.0 or later
            newsFeedEntries = Repro.getNewsFeeds(20, lastItemId, NewsFeedCampaignType.PushNotification);
        } catch (IOException e) {
            // Error handling
            ...
        } catch (RuntimeException e) {
            // Error handling
            ...
        }
    }
}).start();
...

// Get the ID of the last item (1111)
uint64_t lastItemId = [[[Repro getNewsFeeds:20 error:&error] lastObject] ID];

// iOS SDK 4.8.0 or later
NSError *error = nil;
NSArray<RPRNewsFeedEntry *> *newsFeedEntries = [Repro getNewsFeeds:20 offsetID:lastItemId error:&error];
if (error) {
    // Error handling
}

// iOS SDK 5.8.0 or later
NSError *error = nil;
NSArray<RPRNewsFeedEntry *> *newsFeedEntries = [Repro getNewsFeeds:20
                                                          offsetID:lastItemId
                                                      campaignType:RPRCampaignTypePushNotification
                                                             error:&error];
if (error) {
    // Error handling
}

...
...

// Get last item (1111)
let lastItem = try! Repro.getNewsFeeds(20).last

// iOS SDK 4.8.0 or later
var newsFeeds: [RPRNewsFeedEntry]?
if let lastItem = lastItem {
    do {
        newsFeeds = try Repro.getNewsFeeds(20, offsetID: lastItem.id)
    } catch {
        // Error handling
    }
}

// iOS SDK 5.8.0 or later
var newsFeeds: [RPRNewsFeedEntry]?
if let lastItem = lastItem {
    do {
        newsFeeds = try Repro.getNewsFeeds(20, offsetID: lastItem.id, campaignType: .pushNotification)
    } catch {
        // Error handling
    }
}

...
...

// Get the ID of the last item (1111)
uint64_t lastItemId = ReproCpp::getNewsFeeds(20, &error).back().getID();

// Cocos2d-x SDK 5.0.0 or later
bool error;
std::vector<ReproCpp::NewsFeedEntry> newsFeeds = ReproCpp::getNewsFeeds(20, lastItemId, &error);
if (error) {
    // Error handling
}

// Cocos2d-x SDK 5.7.0 or later
bool error;
std::vector<ReproCpp::NewsFeedEntry> newsFeeds = ReproCpp::getNewsFeeds(20, lastItemId, ReproCpp::CampaignType::PushNotification, &error);
if (error) {
    // Error handling
}

...
...

// Get the ID of the last item (1111)
var feeds = Repro.GetNewsFeeds(20);
var lastItemId = feeds.Last().Id; // 1111

// Unity SDK 6.0.0 or later
// (Get only push notification histories)
var newsFeedEntries = Repro.GetNewsFeeds(20, lastItemId);

// Unity SDK 6.7.0 or later
var newsFeedEntries = Repro.GetNewsFeeds(20, lastItemId, NewsFeedCampaignType.PushNotification);

...
...

// Get the ID of the last item (1111)
let lastItemId;
Repro.getNewsFeeds(20, (_, newsFeeds) => {
    lastItemId = newsFeeds.slice(-1)[0].id;
});

...

// React Native SDK 3.0.0 or later
Repro.getNewsFeedsFor(20, lastItemId, (_, newsFeeds) => {
    ...
});

// React Native SDK 3.7.0 or later
Repro.getNewsFeedsWithCampaignTypeFor(20, lastItemId, Repro.CAMPAIGN_TYPE_PUSH_NOTIFICATION, (_, newsFeeds) => {
    ...
});

...
...

// Cordova Plugin 6.0.0 or later
Repro.getNewsFeedsWithLimitAndOffsetId(
    20,
    1111,
    (newsFeeds) => {
        ...
    },
    (error) => {
        // Error handling
    }
);

// Cordova Plugin 6.7.0 or later
Repro.getNewsFeedsWithLimitAndOffsetIdAndCampaignType(
    20,
    1111,
    Repro.CampaignType.InAppMessage,
    (newsFeeds) => {
        ...
    },
    (error) => {
        // Error handling
    }
);

...
...
// Get the ID of the last item (1111)
final feeds = await Repro.getNewsFeeds(20);
final lastItemId = feeds.last.id; // 1111

// Flutter Package 1.0.0—1.6.0
// (Get only push notification histories)
final newsfeeds = await Repro.getNewsFeeds(20, lastItemId);

// Flutter Package 2.0.0 or later
final newsfeeds = await Repro.getNewsFeeds(limit: 20, offsetID: lastItemId, campaignType: NewsFeedCampaignType.PushNotification);

...

Update newsfeed¶

Interfaces¶

public final class Repro {
    public static void updateNewsFeeds(List<NewsFeedEntry> newsFeeds) throws IOException, RuntimeException;
}
@interface Repro : NSObject

+ (BOOL)updateNewsFeeds:(nonnull NSArray<RPRNewsFeedEntry *> *)newsFeeds error:(NSError * _Nullable * _Nullable)error
NS_SWIFT_NAME(updateNewsFeeds(_:));

@end
class Repro: NSObject {
    class func updateNewsFeeds(_ newsFeeds: [RPRNewsFeedEntry]) throws {
    }
}
class ReproCpp {

public:

    static bool updateNewsFeeds(std::vector<ReproCpp::NewsFeedEntry> newsFeeds, bool *error);

};
public class Repro
{
    public static void UpdateNewsFeeds(List<NewsFeedEntry> newsFeeds);
}
const Repro = {
    updateNewsFeeds: (newsFeeds, callback) => void;
}
const Repro = {
    updateNewsFeeds: (newsFeeds, successCallback, errorCallback) => void;
}
class Repro {
    static Future<void> updateNewsFeeds(List<NewsFeedEntry> newsFeeds)
}

The example of implementation to update a campaign’s reading status to “read” in newsfeed.¶

new Thread(new Runnable() {
    @Override
    public void run() {
        // Get 20 newsfeed campaigns
        List<NewsFeedEntry> newsFeedEntries;
        try {
            newsFeedEntries = Repro.getNewsFeeds(20);
        } catch (IOException e) {
            // Error handling
            ...
        } catch (RuntimeException e) {
            // Error handling
            ...
        }

        ...

        // Update procedure
        NewsFeedEntry newsFeedEntry = newsFeedEntries.get(0);
        newsFeedEntry.read = true;

        List<NewsFeedEntry> updateNewsFeedEntries = new ArrayList<>();
        newsFeedEntries.add(newsFeedEntry);
        try {
            Repro.updateNewsFeeds(newsFeedEntries);
        } catch (IOException e) {
            // Error handling
            ...
        } catch (RuntimeException e) {
            // Error handling
            ...
        }
    }
}).start();
...

// Get 20 newsfeed campaigns
NSArray<RPRNewsFeedEntry *> *newsFeeds = [Repro getNewsFeeds:20 error:&error];

...

RPRNewsFeedEntry *newsFeed = newsFeeds[0];
newsFeed.read = true;
[Repro updateNewsFeeds:@[newsFeed] error:&error];

...
...

// Get 20 campaigns as a newsfeed
self.newsFeeds = try? Repro.getNewsFeeds(20)

...

if let newsFeed = newsFeeds?.first {
    newsFeed.read = true
    Repro.updateNewsFeeds([newsFeed])
}
...

// Get 20 newsfeed campaigns
bool error;
std::vector<ReproCpp::NewsFeedEntry> newsFeeds = ReproCpp::getNewsFeeds(20, &error);
if (error) {
    // Error handling
}

...

// Update procedure
ReproCpp::NewsFeedEntry newsFeedEntry = newsFeeds[0];
newsFeedEntry.setRead(true);
ReproCpp::updateNewsFeeds(newsFeeds, &error);
...

// Get 20 newsfeed campaigns
var newsFeedEntries = Repro.getNewsFeeds(20);

...

// Update procedure
var newsFeedEntry = newsFeedEntries[0];
newsFeedEntry.Read = true;
var updateTargets = new List<NewsFeedEntry> { newsFeedEntry };
Repro.UpdateNewsFeeds(updateTargets);
...

let newsfeeds;

Repro.getNewsFeeds(20, (_, entries) => {
    newsfeeds = entries;
});

...

newsfeeds[0].read = true;

Repro.updateNewsFeeds(newsfeeds, (_) => {
});

...
...

let newsFeedEntries;

Repro.getNewsFeedsWithLimit(
    20,
    (newsFeeds) => {
        newsFeedEntries = newsFeeds;
    },
    (error) => {
        // Error handling
    }
});

...

newsFeedEntries[0].read = true;

Repro.updateNewsFeeds(
    newsFeedEntries,
    (_) => {
        ...
    },
    (error) => {
        // Error handling
    }
);

...
...

// Flutter Package 1.0.0—1.5.0
final newsFeeds = await Repro.getNewsFeeds(20);

// Flutter Package 2.0.0 or later
final newsFeeds = await Repro.getNewsFeeds(limit: 20, campaignType: NewsFeedCampaignType.PushNotification);

...

newsFeeds.first.read = true;
await Repro.updateNewsFeeds(newsFeeds);

...
  • « Push Notification (Flutter)
  • In-App Message »

About Us Careers Terms of Service Privacy Policy Cookie Policy

© 2022 Repro Inc.