增加极光推送
This commit is contained in:
@@ -19,6 +19,10 @@ import com.ttstd.dialer.manager.AppManager;
|
||||
import com.ttstd.dialer.utils.SystemUtils;
|
||||
import com.ttstd.iconloader.IconCacheManager;
|
||||
|
||||
import cn.jiguang.api.JCoreInterface;
|
||||
import cn.jiguang.api.utils.JCollectionAuth;
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
|
||||
public class BaseApplication extends Application {
|
||||
private static final String TAG = "BaseApplication";
|
||||
@@ -54,6 +58,26 @@ public class BaseApplication extends Application {
|
||||
String rootDir = MMKV.initialize(this);
|
||||
Log.e(TAG, "mmkv root: " + rootDir);
|
||||
|
||||
/*jpush start*/
|
||||
JPushInterface.setDebugMode(true);
|
||||
// 调整点一:调用启用推送业务功能代码前增加setAuth调用
|
||||
boolean isPrivacyReady = true; // app根据是否已弹窗获取隐私授权来赋值
|
||||
if (!isPrivacyReady) {
|
||||
// JCore 5.0.4之前版本需要显式设置false
|
||||
if (JCoreInterface.getJCoreSDKVersionInt() < 504) { // 5.0.4版本号对应504
|
||||
JCollectionAuth.setAuth(context, false);
|
||||
}
|
||||
// 所有版本在未授权时都不应初始化SDK
|
||||
return;
|
||||
}
|
||||
JPushInterface.init(this);
|
||||
JPushInterface.setAlias(this, );
|
||||
|
||||
// 调整点二:App用户同意了隐私政策授权,并且开发者确定要开启推送服务后调用
|
||||
// JCore 5.0.4+会自动处理授权状态,可不需要显式设置true
|
||||
JCollectionAuth.setAuth(context, true);
|
||||
/*jpush end*/
|
||||
|
||||
HeConfig.init(BuildConfig.QweatherId, BuildConfig.QweatherKey);
|
||||
//切换至免费订阅
|
||||
HeConfig.switchToDevService();
|
||||
|
||||
Reference in New Issue
Block a user