GDTSDKConfig.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //
  2. // GDTSDKConfig.h
  3. // GDTMobApp
  4. //
  5. // Created by GaoChao on 14/8/25.
  6. // Copyright (c) 2014年 Tencent. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "GDTSDKDefines.h"
  10. #import "GDTAdTestSetting.h"
  11. extern NSString *const kGDTDarkModeInfo;
  12. extern NSString *const kGDTDarkModeTypeSplash;
  13. extern NSString *const kGDTDarkModeTypeReward;
  14. extern NSString *const kGDTDarkModeTypeExpress;
  15. extern NSString *const kGDTDarkModeTypeBanner;
  16. extern NSString *const kGDTDarkModeTypeInterstitial;
  17. extern NSString *const kGDTDarkModeTypeInterstitialFullScreen;
  18. extern NSString *const kGDTDarkModeTypeNative;
  19. @interface GDTSDKConfig : NSObject
  20. /**
  21. SDK 注册接口,请在 app 初始化时调用。
  22. @param appId - 开发者平台注册得到的appId
  23. @return 注册是否成功。
  24. */
  25. + (BOOL)registerAppId:(NSString *)appId GDT_DEPRECATED_MSG_ATTRIBUTE("接口即将废弃,请使用initWithAppId和startWithCompletionHandler新接口");
  26. /**
  27. * SDK初始化
  28. * @param appId - 开发者平台注册得到的appId
  29. * @return 初始化是否成功
  30. * @note 调用initWithAppId接口后,请尽快调用startWithCompletionHandler接口;如果不调用startWithCompletionHandler接口,会影响SDK功能。
  31. */
  32. + (BOOL)initWithAppId:(NSString *)appId;
  33. /**
  34. * 启动SDK
  35. * @param handler - 启动成功|失败的结果回调
  36. * @note 请先调用initWithAppId接口,再调用startWithCompletionHandler接口。
  37. */
  38. + (void)startWithCompletionHandler:(void(^)(BOOL success, NSError *error))handler;
  39. /**
  40. * 提供给聚合平台用来设定SDK 流量分类
  41. */
  42. + (void)setSdkSrc:(NSString *)sdkSrc;
  43. /**
  44. * 查看SDK流量来源
  45. */
  46. + (NSString *)sdkSrc;
  47. /**
  48. * 获取 SDK 版本
  49. */
  50. + (NSString *)sdkVersion;
  51. /**
  52. * 设置流量渠道号
  53. 渠道号信息主要用来协助平台提升流量变现效果及您的收益,请如实填写,若渠道号无法满足您的诉求请联系平台负责商务
  54. 渠道号映射关系为:
  55. 1:百度
  56. 2:头条
  57. 3:广点通
  58. 4:搜狗
  59. 5:其他网盟
  60. 6:oppo
  61. 7:vivo
  62. 8:华为
  63. 9:应用宝
  64. 10:小米
  65. 11:金立
  66. 12:百度手机助手
  67. 13:魅族
  68. 14:AppStore
  69. 999:其他
  70. */
  71. + (void)setChannel:(NSInteger)channel;
  72. + (void)setSDKType:(NSInteger)type;
  73. /**
  74. 在播放音频时是否使用SDK内部对AVAudioSession设置的category及options,默认使用,若不使用,SDK内部不做任何处理,由调用方在展示广告时自行设置;
  75. SDK设置的category为AVAudioSessionCategoryAmbient,options为AVAudioSessionCategoryOptionDuckOthers
  76. */
  77. + (void)enableDefaultAudioSessionSetting:(BOOL)enabled;
  78. + (GDTAdTestSetting *)debugSetting;
  79. /**
  80. 设置开发阶段调试相关的配置
  81. */
  82. + (void)setDebugSetting:(GDTAdTestSetting *)debugSetting;
  83. + (void)forbiddenIDFA:(BOOL)forbiddened;
  84. /**
  85. 获取 buyerId 用于 Server Bidding 请求获取 token, 建议每次请求前调用一次, 并使用最新值请求
  86. */
  87. + (NSString *)getBuyerIdWithContext:(NSDictionary *)info;
  88. /**
  89. 获取用于 Server Bidding 请求SDK侧相关请求参数信息
  90. */
  91. + (NSString *)getSDKInfoWithPlacementId:(NSString *)placementId;
  92. /**
  93. 设置个性化推荐状态
  94. @param state 1为关闭个性化推荐,其他值或未设置为打开
  95. */
  96. + (void)setPersonalizedState:(NSInteger)state;
  97. /**
  98. 设置用户信息
  99. @param extraUserDictionary 必须为有效的字符串格式的键值对
  100. 已支持的key有:
  101. @"lng",实时的地理位置经度,值为字符串格式的经度值,比如@“116.67765”
  102. @"lat", 实时的地理位置纬度,值为字符串格式的纬度值,比如@"39.365678"
  103. @"loc_time",实时的地理位置获取时间,值为字符串格式的unix时间戳,单位秒,比如@"1639450944"
  104. @"shakable",是否关闭摇一摇,值为字符串格式,”0“:关闭摇一摇;”1“:开启摇一摇
  105. @"sensor_ts", 是否开启传感器,值为字符串格式,“1”:开启传感器 “0”:关闭传感器
  106. */
  107. + (void)setExtraUserData:(NSDictionary <NSString *, NSString *> *)extraUserDictionary;
  108. /**
  109. 设置用户信息
  110. @param mediaExtDictionary, 必须为有效的字符串格式的键值对
  111. 已支持的key有:
  112. @"user_id",用户的id,比如QQ号
  113. @param overrideOld, 新的mediaExtDictionary是否覆盖之前设置的mediaExtDictionary
  114. */
  115. + (void)setMediaExtData:(NSDictionary <NSString *, NSString *> *)mediaExtDictionary overrideOldData:(BOOL)overrideOld;
  116. /**
  117. 设置自定义信息
  118. @param customInfo, 必须为有效的 NSDictionary
  119. 已支持
  120. key kGDTDarkModeInfo (NSString 需申请后生效)
  121. value (NSDictionary)
  122. key kGDTDarkModeTypeSplash (NSString)
  123. value #66FFFFFF (NSString)
  124. exp:
  125. [GDTSDKConfig setCustomInfo:@{
  126. kGDTDarkModeInfo : @{
  127. kGDTDarkModeTypeSplash : @"#66FFFFFF"
  128. }
  129. }];
  130. */
  131. + (void)setCustomInfo:(NSDictionary <NSString *, NSDictionary *> *)customInfo;
  132. @end