Commit 12c6992a authored by mengcuiguang's avatar mengcuiguang

1.0.3 添加极光推送

parent bfb8faac
......@@ -27,6 +27,9 @@ android {
}
manifestPlaceholders = [CHANNEL_NAME_VALUE: "fairyland",
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : RELEASE_JPUSH_KEY,
JPUSH_CHANNEL : "fairyland",
UMENG_KEY : RELEASE_UMENG_KEY,
APPLOG_SCHEME : "rangersapplog.byAx6uYt".toLowerCase(),
SHARE_KEY : RELEASE_SHARESDK_KEY,
......@@ -179,8 +182,8 @@ dependencies {
// leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
// 极光推送
// implementation 'cn.jiguang.sdk:jpush:3.6.6'
// implementation 'cn.jiguang.sdk:jcore:2.3.8'
implementation 'cn.jiguang.sdk:jpush:3.6.6'
implementation 'cn.jiguang.sdk:jcore:2.3.8'
// 移动安全联盟
implementation(name: 'msa_mdid_1.0.13', ext: 'aar')
// 穿山甲广告
......
......@@ -59,6 +59,14 @@
android:name="Mob-AppSecret"
android:value="${SHARE_SECRET}" />
<!-- 极光 -->
<meta-data
android:name="JPUSH_APPKEY"
android:value="${JPUSH_APPKEY}" />
<meta-data
android:name="JPUSH_CHANNEL"
android:value="${JPUSH_CHANNEL}" />
<activity
android:name="com.mints.fairyland.ui.activitys.SplashYlhActivity"
android:screenOrientation="portrait">
......
package com.mints.fairyland;
import android.app.ActivityManager;
import android.app.Notification;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
......@@ -31,6 +32,8 @@ import com.umeng.commonsdk.UMConfigure;
import java.util.concurrent.Executors;
import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import rx.Scheduler;
import rx.schedulers.Schedulers;
......@@ -128,6 +131,9 @@ public class MintsApplication extends MultiDexApplication {
// 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk();
// 极光推送
initJpush();
}
/**
......@@ -192,6 +198,20 @@ public class MintsApplication extends MultiDexApplication {
}
}
/**
* 绑定jpush
*/
private void initJpush() {
JPushInterface.setDebugMode(BuildConfig.DEBUG); // 设置开启日志,发布时请关闭日志
JPushInterface.init(this);
BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(getApplicationContext());
builder.statusBarDrawable = R.mipmap.ic_launcher;
builder.notificationFlags = Notification.FLAG_AUTO_CANCEL; //设置为自动消失
builder.notificationDefaults = Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS; // 设置为铃声与震动都要
JPushInterface.setDefaultPushNotificationBuilder(builder);
}
private String getProcessName(Context context) {
if (context == null) return null;
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
......
......@@ -197,17 +197,24 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
}
private fun readyGoOtherActivity() {
val customVersion: Int = ps.getInt(Constant.CUSTOM_VERSION, 0)
val isFirstEnter: Boolean = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true)
if (isFirstEnter) {
readyGoThenKill(GuideActivity::class.java)
// val customVersion: Int = ps.getInt(Constant.CUSTOM_VERSION, 0)
// val isFirstEnter: Boolean = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true)
// if (isFirstEnter) {
// readyGoThenKill(GuideActivity::class.java)
// } else {
// val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
// if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
// readyGo(LoginActivity::class.java)
// } else {
// readyGoThenKill(MainActivity::class.java)
// }
// }
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
readyGo(LoginActivity::class.java)
} else {
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
readyGo(LoginActivity::class.java)
} else {
readyGoThenKill(MainActivity::class.java)
}
readyGoThenKill(MainActivity::class.java)
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment