Repro - Mobile Analytics for growth
English
アカウント登録 管理画面に戻る
  • 動作環境
  • 管理画面ガイド
  • 開発ガイド
    • アカウント作成
    • iOS/Android SDK
      • 導入
      • セッション・ライフサイクル
      • ユーザーID
      • デバイスID
      • ユーザープロフィール
      • イベントトラッキング
      • プッシュ通知
      • ニュースフィード
        • ニュースフィードの仕様について
          • 一度に取得可能なキャンペーン数
          • 遡ることの出来るキャンペーン期間
        • ニュースフィードインターフェース
          • データ形式
          • ニュースフィードを取得する
          • ニュースフィードを更新する
      • アプリ内メッセージ
      • シルバーエッグレコメンドメッセージ
      • アプリ内パラメーター
      • WebView
      • オプトアウト機能
      • 広告ID取得設定
      • QRコードを用いてオーディエンスにユーザーを登録する
      • Adjustで取得したアトリビューションデータをReproにセットする
      • AppsFlyerで取得したアトリビューションデータをReproにセットする
      • ログレベル
      • 検証方法
    • Web
    • オーディエンスAPI
    • オーディエンスインポート(β)
    • プッシュAPI
    • ユーザープロフィールAPI
    • ユーザープロフィールバルクインポート
    • ニュースフィードAPI
    • 削除ユーザー登録API
    • Booster導入ガイド
    • メール(β)
  • リリースノート
  • FAQ

ニュースフィード¶

ニュースフィードを利用することで、プッシュ通知(スタンダード形式で作成されたもの)、アプリ内メッセージ および Webメッセージの履歴の取得が可能です。

ニュースフィードの仕様について¶

一度に取得可能なキャンペーン数¶

最新のキャンペーンから遡って最大で 200 通まで一度に取得可能です。200を超えて取得したい場合は、レスポンスの末尾の要素のIDを オフセットを利用して取得 のパラメータとして利用し、再度取得をしてください。

警告

プッシュ通知のキャンペーンの履歴をニュースフィード機能で取得するためには、以下のいずれかの SDK を利用する必要があります。

  • Android SDK 5.0.1 以上
  • iOS SDK 4.8.0 以上
  • Unity SDK 6.0.0 以上
  • React Native SDK 3.0.0 以上
  • Cordova Plugin 6.0.0 以上
  • Cocos2d-x SDK 5.0.0 以上
  • Flutter Package 1.0.0 以上

また、アプリ内メッセージおよびWebメッセージの履歴を取得するためには、以下のいずれかの SDK が必要です。

  • Android SDK 5.6.0 以上
  • iOS SDK 5.8.0 以上
  • Unity SDK 6.7.0 以上
  • React Native SDK 3.7.0 以上
  • Cordova Plugin 6.7.0 以上
  • Cocos2d-x SDK 5.7.0 以上
  • Flutter Package 2.0.0 以上

警告

ニュースフィードの機能を利用するには、以下の通りにキャンペーンが作成されている必要があります。

  1. 当該のキャンペーンはスタンダード形式で作成されている。(プッシュ通知の場合)
  2. キャンペーンの作成時に「通知をニュースフィードとして使う」のチェックボックスにチェックしてある。

警告

カスタム JSON や PUSH API が指定されているキャンペーンはニュースフィードとして利用することができません。ご注意ください。

遡ることの出来るキャンペーン期間¶

リクエスト日を起点にして、 30日以内 に配信されたキャンペーンが取得可能です。

ニュースフィードインターフェース¶

データ形式¶

ニュースフィードは以下のようなデータ形式になっています。

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;
}

警告

link_url image_url は非推奨となっています。同じデータを持っている link_url_string image_url_string をご利用ください。

  • 理由: URLにマルチバイト文字を使用した場合に、OSによって正しく変換されないことがあったため、非推奨としております(例: NSURL )

link_url_string image_url_string は以下の SDK をご利用の場合のみ取得可能です。

  • Android SDK 5.16.0 以上
  • iOS SDK 5.17.0 以上
  • Unity SDK 6.18.0 以上
  • React Native SDK 3.19.0 以上
  • Cordova Plugin 6.19.0 以上
  • Cocos2d-x SDK 5.18.0 以上
  • Flutter Package 3.10.0 以上

link_url_string image_url_string は、文字列もしくは空文字が設定されます。

link_url を設定しなかった場合、返り値として null が設定されますが、2022/03/08以前に作成されたキャンペーンにつきましては、空文字が返る可能性があります。

また、キャンペーン種別として指定可能な値は以下のデータ形式となっています。

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
}

警告

CampaignType およびこれを利用するフィールドは、以下の SDK をご利用の場合のみ取得可能です。

  • Android SDK 5.6.0 以上
  • iOS SDK 5.8.0 以上
  • Unity SDK 6.7.0 以上
  • React Native SDK 3.7.0 以上
  • Cordova Plugin 6.7.0 以上
  • Cocos2d-x SDK 5.7.0 以上
  • Flutter Package 2.0.0 以上

ニュースフィードを取得する¶

取得インターフェース¶

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 })
}

警告

ご利用中の SDK のバージョンによって、使用可能なメソッドが異なります。

警告

キャンペーン種別 ( campaignType ) の指定のないメソッドを実行した場合は、ご利用中の SDK のバージョンによらずプッシュ通知の履歴 のみ が取得されます。

最新のキャンペーン20通を取得する実装例¶

以下では、最新のキャンペーン20通をニュースフィードとして取得する処理を例にあげます。

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)

...

オフセットを指定し、それ以後のキャンペーン20通を取得する実装例¶

以下では、あるキャンペーン以後の(そのキャンペーンに対応するIDが1111であるとします。)キャンペーン20通をニュースフィードとして取得する処理を例にあげます。

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);

...

ニュースフィードを更新する¶

取得インターフェース¶

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)
}

取得したニュースフィードの中の一通を既読済みに更新する処理の実装例¶

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);

...
  • « プッシュ通知 (Flutter)
  • アプリ内メッセージ »

About Us Careers Terms of Service Privacy Policy Cookie Policy

© 2022 Repro Inc.