NIMSDK-AOS  10.5.0
MixPushConfig.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.mixpush;
2 
3 import androidx.annotation.Nullable;
4 import java.io.Serializable;
5 import org.json.JSONException;
6 import org.json.JSONObject;
7 
12 public class MixPushConfig implements Serializable {
13  public static final String KEY_XM_APP_ID = "KEY_XM_APP_ID";
14  public static final String KEY_XM_APP_KEY = "KEY_XM_APP_KEY";
15  public static final String KEY_XM_CERTIFICATE_NAME = "KEY_XM_CERTIFICATE_NAME";
16  public static final String KEY_HW_APP_ID = "KEY_HW_APP_ID";
17  public static final String KEY_HW_CERTIFICATE_NAME = "KEY_HW_CERTIFICATE_NAME";
18  public static final String KEY_MZ_APP_ID = "KEY_MZ_APP_ID";
19  public static final String KEY_MZ_APP_KEY = "KEY_MZ_APP_KEY";
20  public static final String KEY_MZ_CERTIFICATE_NAME = "KEY_MZ_CERTIFICATE_NAME";
21  public static final String KEY_FCM_CERTIFICATE_NAME = "KEY_FCM_CERTIFICATE_NAME";
22  public static final String KEY_VIVO_CERTIFICATE_NAME = "KEY_VIVO_CERTIFICATE_NAME";
23  public static final String KEY_OPPO_APP_ID = "KEY_OPPO_APP_ID";
24  public static final String KEY_OPPO_APP_KEY = "KEY_OPPO_APP_KEY";
25  public static final String KEY_OPPO_APP_SERCET = "KEY_OPPO_APP_SERCET";
26  public static final String KEY_OPPO_CERTIFICATE_NAME = "KEY_OPPO_CERTIFICATE_NAME";
27  public static final String KEY_AUTO_SELECT_PUSH_TYPE = "KEY_AUTO_SELECT_PUSH_TYPE";
28  public static final String KEY_HONOR_CERTIFICATE_NAME = "KEY_HONOR_CERTIFICATE_NAME";
29 
33  public String xmAppId;
34 
38  public String xmAppKey;
39 
43  public String xmCertificateName;
44 
48  public String hwAppId;
49 
54  public String hwCertificateName;
55 
59  public String mzAppId;
60 
64  public String mzAppKey;
65 
69  public String mzCertificateName;
70 
75  public String fcmCertificateName;
76 
81  public String vivoCertificateName;
82 
86  public String oppoAppId;
87 
91  public String oppoAppKey;
92 
96  public String oppoAppSercet;
97 
101  public String oppoCertificateName;
102 
107  public String honorCertificateName;
108 
112  public boolean autoSelectPushType = false;
113 
114 
115  public JSONObject toJson() {
116  JSONObject object = new JSONObject();
117 
118  try {
119  object.putOpt(KEY_XM_APP_ID, xmAppId);
120  object.putOpt(KEY_XM_APP_KEY, xmAppKey);
121  object.putOpt(KEY_XM_CERTIFICATE_NAME, xmCertificateName);
122  object.putOpt(KEY_HW_APP_ID, hwAppId);
123  object.putOpt(KEY_HW_CERTIFICATE_NAME, hwCertificateName);
124  object.putOpt(KEY_MZ_APP_ID, mzAppId);
125  object.putOpt(KEY_MZ_APP_KEY, mzAppKey);
126  object.putOpt(KEY_MZ_CERTIFICATE_NAME, mzCertificateName);
127  object.putOpt(KEY_FCM_CERTIFICATE_NAME, fcmCertificateName);
128  object.putOpt(KEY_VIVO_CERTIFICATE_NAME, vivoCertificateName);
129  object.putOpt(KEY_OPPO_APP_ID, oppoAppId);
130  object.putOpt(KEY_OPPO_APP_KEY, oppoAppKey);
131  object.putOpt(KEY_OPPO_APP_SERCET, oppoAppSercet);
132  object.putOpt(KEY_OPPO_CERTIFICATE_NAME, oppoCertificateName);
133  object.putOpt(KEY_AUTO_SELECT_PUSH_TYPE, autoSelectPushType);
134  object.putOpt(KEY_HONOR_CERTIFICATE_NAME, honorCertificateName);
135  } catch (JSONException e) {
136  e.printStackTrace();
137  }
138  return object;
139  }
140 
141  public static MixPushConfig fromJson(@Nullable JSONObject object) {
142  if (object == null) {
143  return null;
144  }
145  MixPushConfig config = new MixPushConfig();
146 
147  config.xmAppId = object.optString(KEY_XM_APP_ID, null);
148  config.xmAppKey = object.optString(KEY_XM_APP_KEY, null);
149  config.xmCertificateName = object.optString(KEY_XM_CERTIFICATE_NAME, null);
150  config.hwAppId = object.optString(KEY_HW_APP_ID, null);
151  config.hwCertificateName = object.optString(KEY_HW_CERTIFICATE_NAME, null);
152  config.mzAppId = object.optString(KEY_MZ_APP_ID, null);
153  config.mzAppKey = object.optString(KEY_MZ_APP_KEY, null);
154  config.mzCertificateName = object.optString(KEY_MZ_CERTIFICATE_NAME, null);
155  config.fcmCertificateName = object.optString(KEY_FCM_CERTIFICATE_NAME, null);
156  config.vivoCertificateName = object.optString(KEY_VIVO_CERTIFICATE_NAME, null);
157  config.oppoAppId = object.optString(KEY_OPPO_APP_ID, null);
158  config.oppoAppKey = object.optString(KEY_OPPO_APP_KEY, null);
159  config.oppoAppSercet = object.optString(KEY_OPPO_APP_SERCET, null);
160  config.oppoCertificateName = object.optString(KEY_OPPO_CERTIFICATE_NAME, null);
161  config.autoSelectPushType = object.optBoolean(KEY_AUTO_SELECT_PUSH_TYPE, false);
162  config.honorCertificateName = object.optString(KEY_HONOR_CERTIFICATE_NAME, null);
163  return config;
164  }
165 
166 }
static MixPushConfig fromJson(@Nullable JSONObject object)
String fcmCertificateName
FCM 推送证书,请在云信管理后台申请 海外客户使用
String xmCertificateName
小米推送证书,请在云信管理后台申请
String oppoAppSercet
oppo 推送AppSecret
String honorCertificateName
荣耀推送 appId请在 AndroidManifest.xml 文件中配置 荣耀推送证书,请在云信管理后台申请 ...
String hwCertificateName
华为推送证书,请在云信管理后台申请
Created by chenkang on 2017/11/20.
boolean autoSelectPushType
是否根据token自动选择推送类型
String mzCertificateName
魅族推送证书,请在云信管理后台申请
String oppoCertificateName
OPPO推送证书,请在云信管理后台申请
String vivoCertificateName
VIVO推送 appId apiKey请在 AndroidManifest.xml 文件中配置 VIVO推送证书,请在云信管理后台申请 ...