Commit 12c6992a authored by mengcuiguang's avatar mengcuiguang

1.0.3 添加极光推送

parent bfb8faac
...@@ -27,6 +27,9 @@ android { ...@@ -27,6 +27,9 @@ android {
} }
manifestPlaceholders = [CHANNEL_NAME_VALUE: "fairyland", manifestPlaceholders = [CHANNEL_NAME_VALUE: "fairyland",
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : RELEASE_JPUSH_KEY,
JPUSH_CHANNEL : "fairyland",
UMENG_KEY : RELEASE_UMENG_KEY, UMENG_KEY : RELEASE_UMENG_KEY,
APPLOG_SCHEME : "rangersapplog.byAx6uYt".toLowerCase(), APPLOG_SCHEME : "rangersapplog.byAx6uYt".toLowerCase(),
SHARE_KEY : RELEASE_SHARESDK_KEY, SHARE_KEY : RELEASE_SHARESDK_KEY,
...@@ -179,8 +182,8 @@ dependencies { ...@@ -179,8 +182,8 @@ dependencies {
// leakcanary // leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4' debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
// 极光推送 // 极光推送
// implementation 'cn.jiguang.sdk:jpush:3.6.6' implementation 'cn.jiguang.sdk:jpush:3.6.6'
// implementation 'cn.jiguang.sdk:jcore:2.3.8' implementation 'cn.jiguang.sdk:jcore:2.3.8'
// 移动安全联盟 // 移动安全联盟
implementation(name: 'msa_mdid_1.0.13', ext: 'aar') implementation(name: 'msa_mdid_1.0.13', ext: 'aar')
// 穿山甲广告 // 穿山甲广告
......
...@@ -59,6 +59,14 @@ ...@@ -59,6 +59,14 @@
android:name="Mob-AppSecret" android:name="Mob-AppSecret"
android:value="${SHARE_SECRET}" /> 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 <activity
android:name="com.mints.fairyland.ui.activitys.SplashYlhActivity" android:name="com.mints.fairyland.ui.activitys.SplashYlhActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
......
package com.mints.fairyland; package com.mints.fairyland;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.Notification;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
...@@ -31,6 +32,8 @@ import com.umeng.commonsdk.UMConfigure; ...@@ -31,6 +32,8 @@ import com.umeng.commonsdk.UMConfigure;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import cn.jpush.android.api.BasicPushNotificationBuilder;
import cn.jpush.android.api.JPushInterface;
import rx.Scheduler; import rx.Scheduler;
import rx.schedulers.Schedulers; import rx.schedulers.Schedulers;
...@@ -128,6 +131,9 @@ public class MintsApplication extends MultiDexApplication { ...@@ -128,6 +131,9 @@ public class MintsApplication extends MultiDexApplication {
// 猎豹游戏初始化 // 猎豹游戏初始化
LiebaoManager.getInstance().initCmGameSdk(); LiebaoManager.getInstance().initCmGameSdk();
// 极光推送
initJpush();
} }
/** /**
...@@ -192,6 +198,20 @@ public class MintsApplication extends MultiDexApplication { ...@@ -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) { private String getProcessName(Context context) {
if (context == null) return null; if (context == null) return null;
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
......
...@@ -197,17 +197,24 @@ class SplashYlhActivity : BaseActivity(), SplashADListener { ...@@ -197,17 +197,24 @@ class SplashYlhActivity : BaseActivity(), SplashADListener {
} }
private fun readyGoOtherActivity() { private fun readyGoOtherActivity() {
val customVersion: Int = ps.getInt(Constant.CUSTOM_VERSION, 0) // val customVersion: Int = ps.getInt(Constant.CUSTOM_VERSION, 0)
val isFirstEnter: Boolean = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true) // val isFirstEnter: Boolean = ps.getBoolean(Constant.ISFIRSTENTER + customVersion, true)
if (isFirstEnter) { // if (isFirstEnter) {
readyGoThenKill(GuideActivity::class.java) // 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 { } else {
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME") readyGoThenKill(MainActivity::class.java)
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE) && !UserManager.getInstance().userIsLogin()) {
readyGo(LoginActivity::class.java)
} else {
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