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

    val id: Long,
    val campaignType: NewsFeedCampaignType,
    val deviceID: String,
    val title: String,
    val summary: String,
    val body: String,
    val linkUrl: Uri,                 // Deprecated
    val linkUrlString: String,
    val imageUrl: Uri,                // Deprecated
    val imageUrlString: String,
    val deliveredAt: Date,
    var shown: Boolean,
    var read: Boolean
)
@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
}
enum class 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;
}
object Repro {

    // Android SDK 5.0.1 or later
    @Throws(IOException::class, RuntimeException::class)
    fun getNewsFeeds(limit: Int): List<NewsFeedEntry>
    @Throws(IOException::class, RuntimeException::class)
    fun getNewsFeeds(limit: Int, offsetID: Long): List<NewsFeedEntry>

    // Only for Android SDK 5.6.0 or later
    @Throws(IOException::class, RuntimeException::class)
    fun getNewsFeeds(limit: Int, campaignType: NewsFeedCampaignType): List<NewsFeedEntry>
    @Throws(IOException::class, RuntimeException::class)
    fun getNewsFeeds(limit: Int, offsetID: Long, campaignType: NewsFeedCampaignType): List<NewsFeedEntry>
}
@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();
Thread {
    // Get 20 campaigns as a newsfeed
    try {
        // Android SDK 5.0.1 or later
        // (Get only push notification histories)
        var newsFeedEntries = Repro.getNewsFeeds(20)

        // Android SDK 5.6.0 or later
        newsFeedEntries = Repro.getNewsFeeds(20, NewsFeedCampaignType.PushNotification)

    } catch (e: IOException) {
        // Error handling
        ...
    } catch (e: RuntimeException) {
        // 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() {
        List<NewsFeedEntry> newsFeedEntries;
        try {
            // Get 20 campaigns as a newsfeed
            List<NewsFeedEntry> feeds = Repro.getNewsFeeds(20);
            if (feeds != null && !feeds.isEmpty()) {
                // Get the ID of the last item (1111)
                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();
Thread {
    try {
        // Get 20 campaigns as a newsfeed
        val feeds = Repro.getNewsFeeds(20)
        if (!feeds.isNullOrEmpty()) {
            // Get the ID of the last item (1111)
            val lastItemId = feeds.last().id

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

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

// Get 20 campaigns as a newsfeed
NSError *error = nil;
NSArray<RPRNewsFeedEntry *> *feeds = [Repro getNewsFeeds:20 error:&error];
if (error == nil && feeds != nil && feeds.count > 0) {
    // Get the ID of the last item (1111)
    uint64_t lastItemId = feeds.lastObject.ID;

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

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

...
...

do {
    // Get 20 campaigns as a newsfeed
    let feeds = try Repro.getNewsFeeds(20)
    if !feeds.isEmpty {
        // Get the ID of the last item (1111)
        let lastItemId = feeds.last!.id

        // iOS SDK 4.8.0 or later
        let newsFeeds = try Repro.getNewsFeeds(20, offsetID: lastItemId)

        // iOS SDK 5.8.0 or later
        let newsFeeds = try Repro.getNewsFeeds(20, offsetID: lastItemId, campaignType: .pushNotification)
    }
} catch {
    // Error handling
}

...
...

// Get 20 campaigns as a newsfeed
bool error = false;
std::vector<ReproCpp::NewsFeedEntry> feeds = ReproCpp::getNewsFeeds(20, &error);
if(!error && !feeds.empty()) {
    // Get the ID of the last item (1111)
    uint64_t lastItemId = feeds.back().getID();

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

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

...
...

// Get 20 campaigns as a newsfeed
var feeds = Repro.GetNewsFeeds(20);
if (feeds != null && feeds.Count > 0) {
    // Get the ID of the last item (1111)
    var lastItemId = feeds.Last().Id;

    // 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 20 campaigns as a newsfeed
Repro.getNewsFeeds(20, (_, feeds) => {
    if (feeds && feeds.length > 0) {
        // Get the ID of the last item (1111)
        const lastItemId = feeds[feeds.length - 1].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) => {
            ...
        });
    }
});

...
...

// Get 20 campaigns as a newsfeed
Repro.getNewsFeedsWithLimit(
    20,
    (feeds) => {
        if (Array.isArray(feeds) && feeds.length > 0) {
            // Get the ID of the last item (1111)
            const lastItemId = feeds[feeds.length - 1].id;

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

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

...
...

// Get 20 campaigns as a newsfeed
final feeds = await Repro.getNewsFeeds(20);
if (feeds.isNotEmpty) {
    // Get the ID of the last item (1111)
    final lastItemId = feeds.last.id;

    // 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;
}
final class Repro {
    @Throws(IOException::class, RuntimeException::class)
    fun updateNewsFeeds(newsFeeds: List<NewsFeedEntry>)
}
@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() {
        List<NewsFeedEntry> newsFeedEntries = null;
        try {
            // Get 20 newsfeed campaigns
            newsFeedEntries = Repro.getNewsFeeds(20);
        } catch (IOException e) {
            // Error handling
            ...
        } catch (RuntimeException e) {
            // Error handling
            ...
        }

        ...

        if (newsFeedEntries != null && !newsFeedEntries.isEmpty()) {
            // Update procedure
            NewsFeedEntry newsFeedEntry = newsFeedEntries.get(0);
            newsFeedEntry.read = true;

            List<NewsFeedEntry> updateNewsFeedEntries = new ArrayList<>();
            updateNewsFeedEntries.add(newsFeedEntry);
            try {
                Repro.updateNewsFeeds(updateNewsFeedEntries);
            } catch (IOException e) {
                // Error handling
                ...
            } catch (RuntimeException e) {
                // Error handling
                ...
            }
        }
    }
}).start();
Thread {
    val newsFeedEntries = try {
        // Get 20 campaigns as a newsfeed
        Repro.getNewsFeeds(20)
    } catch (e: IOException) {
        // Error handling
        ...
        null
    } catch (e: RuntimeException) {
        // Error handling
        ...
        null
    }

    ...

    if (!newsFeedEntries.isNullOrEmpty()) {
        // Update procedure
        val newsFeedEntry = newsFeedEntries[0]
        newsFeedEntry.read = true

        val updateNewsFeedEntries = ArrayList<NewsFeedEntry>()
        updateNewsFeedEntries.add(newsFeedEntry)

        try {
            Repro.updateNewsFeeds(updateNewsFeedEntries)
        } catch (e: IOException) {
            // Error handling
            ...
        } catch (e: RuntimeException) {
            // Error handling
            ...
        }
    }
}.start()
...

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

...

if (error == nil && newsFeeds != nil && newsFeeds.count > 0) {
    // Update procedure
    RPRNewsFeedEntry *newsFeed = newsFeeds[0];
    newsFeed.read = true;
    [Repro updateNewsFeeds:@[newsFeed] error:&error];
    if (error) {
        // Error handling
    }
}

...
...

// 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 = false;
std::vector<ReproCpp::NewsFeedEntry> newsFeeds = ReproCpp::getNewsFeeds(20, &error);
if (error) {
    // Error handling
}

...

if(!newsFeeds.empty()) {
    // Update procedure
    ReproCpp::NewsFeedEntry newsFeedEntry = newsFeeds[0];
    newsFeedEntry.setRead(true);
    std::vector<ReproCpp::NewsFeedEntry> updateTargets = { newsFeedEntry };
    ReproCpp::updateNewsFeeds(updateTargets, &error);
    if (error) {
        // Error handling
    }
}
...

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

...

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

...
...

let newsfeeds;
// Get 20 newsfeed campaigns
Repro.getNewsFeeds(20, (_, entries) => {
    newsfeeds = entries;
});

...

if (newsfeeds && newsfeeds.length > 0) {
    // Update procedure
    newsfeeds[0].read = true;
    Repro.updateNewsFeeds([newsfeeds[0]], (_) => {
    });
}

...
...

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

...

if (Array.isArray(newsFeedEntries) && newsFeedEntries.length > 0) {
    // Update procedure
    newsFeedEntries[0].read = true;
    Repro.updateNewsFeeds(
        newsFeedEntries[0],
        (_) => {
            ...
        },
        (error) => {
            // Error handling
        }
    );

...
...

// Get 20 campaigns as a newsfeed
// 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);

...

if (newsFeeds.isNotEmpty) {
    // Update procedure
    newsFeeds.first.read = true;
    await Repro.updateNewsFeeds([newsFeeds.first]);
}

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

Repro Service Site About Us Careers Terms of Service Privacy Policy Cookie Policy

© 2022 Repro Inc.