├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ └── styles.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── layout │ │ │ ├── item.xml │ │ │ ├── activity_launcher.xml │ │ │ └── activity_main.xml │ │ ├── java │ │ └── com │ │ │ └── jiang │ │ │ └── android │ │ │ └── pushdemo │ │ │ ├── App.java │ │ │ ├── LauncherActivity.java │ │ │ ├── PushService.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── push ├── .gitignore ├── libs │ ├── pushsdk_v2.3.4.jar │ ├── HwPush_SDK_V2705.jar │ ├── com.coloros.mcssdk.jar │ └── MiPush_SDK_Client_3_1_2.jar ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── send.png │ │ │ ├── start.png │ │ │ ├── upload.png │ │ │ ├── pushnotify.png │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ ├── hwpush_ic_cancel.png │ │ │ ├── hwpush_list_icon.png │ │ │ ├── hwpush_main_icon.png │ │ │ ├── hwpush_progress.9.png │ │ │ ├── hwpush_no_collection.png │ │ │ ├── hwpush_ab_bottom_emui.9.png │ │ │ ├── hwpush_background_emui.9.png │ │ │ ├── hwpush_btn_check_on_emui.png │ │ │ ├── hwpush_ic_cancel_light.png │ │ │ ├── hwpush_ic_toolbar_back.png │ │ │ ├── hwpush_ic_toolbar_delete.png │ │ │ ├── hwpush_pic_ab_number.9.png │ │ │ ├── hwpush_btn_check_off_emui.png │ │ │ ├── hwpush_ic_toolbar_advance.png │ │ │ ├── hwpush_ic_toolbar_collect.png │ │ │ ├── hwpush_ic_toolbar_multiple.png │ │ │ ├── hwpush_ic_toolbar_refresh.png │ │ │ ├── hwpush_ic_toolbar_multiple1.png │ │ │ ├── hwpush_list_activated_emui.9.png │ │ │ ├── hwpush_pic_ab_number_light.9.png │ │ │ ├── hwpush_btn_check_off_pressed_emui.png │ │ │ └── hwpush_btn_check_on_pressed_emui.png │ │ ├── values │ │ │ ├── hwpush_styles.xml │ │ │ ├── hwpush_colors.xml │ │ │ ├── jpush_style.xml │ │ │ ├── styles.xml │ │ │ ├── strings.xml │ │ │ └── hwpush_strings.xml │ │ ├── layout │ │ │ ├── hwpush_icons_layout.xml │ │ │ ├── hwpush_buttons_layout.xml │ │ │ ├── hwpush_layout8.xml │ │ │ ├── hwpush_collect_tip_dialog.xml │ │ │ ├── hwpush_collection_item.xml │ │ │ ├── hwpush_layout4.xml │ │ │ ├── hwpush_layout2.xml │ │ │ ├── hwpush_layout7.xml │ │ │ ├── hwpush_collection_listview.xml │ │ │ └── hwpush_msg_show.xml │ │ └── values-zh-rCN │ │ │ └── hwpush_strings.xml │ │ ├── java │ │ └── com │ │ │ └── jiang │ │ │ └── android │ │ │ └── push │ │ │ ├── utils │ │ │ ├── Target.java │ │ │ ├── L.java │ │ │ ├── JHandler.java │ │ │ ├── BuildProperties.java │ │ │ ├── JsonUtils.java │ │ │ └── RomUtil.java │ │ │ ├── IPushManager.java │ │ │ ├── model │ │ │ └── TokenModel.java │ │ │ ├── PushInterface.java │ │ │ ├── Message.java │ │ │ ├── vivo │ │ │ ├── PushMessageReceiverImpl.java │ │ │ └── ViVOPushManager.java │ │ │ ├── flyme │ │ │ ├── FlymePushManager.java │ │ │ └── FlymeReceiver.java │ │ │ ├── emui │ │ │ ├── EMPushManager.java │ │ │ └── EMHuaweiPushReceiver.java │ │ │ ├── jpush │ │ │ ├── JPushManager.java │ │ │ └── JPushReceiver.java │ │ │ ├── Const.java │ │ │ ├── Push.java │ │ │ ├── oppo │ │ │ └── OppoPushManager.java │ │ │ └── miui │ │ │ ├── MiuiPushManager.java │ │ │ └── MiuiReceiver.java │ │ └── AndroidManifest.xml ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── code.zip ├── aar ├── gslb-3.0.9.aar ├── common-1.0.10.aar ├── usage-stats-2.5.1.aar └── push-internal-3.1.160901.aar ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── LICENSE.txt └── README.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /push/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':push' 2 | -------------------------------------------------------------------------------- /code.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/code.zip -------------------------------------------------------------------------------- /aar/gslb-3.0.9.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/aar/gslb-3.0.9.aar -------------------------------------------------------------------------------- /aar/common-1.0.10.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/aar/common-1.0.10.aar -------------------------------------------------------------------------------- /aar/usage-stats-2.5.1.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/aar/usage-stats-2.5.1.aar -------------------------------------------------------------------------------- /push/libs/pushsdk_v2.3.4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/libs/pushsdk_v2.3.4.jar -------------------------------------------------------------------------------- /push/libs/HwPush_SDK_V2705.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/libs/HwPush_SDK_V2705.jar -------------------------------------------------------------------------------- /aar/push-internal-3.1.160901.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/aar/push-internal-3.1.160901.aar -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AndroidPush 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /push/libs/com.coloros.mcssdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/libs/com.coloros.mcssdk.jar -------------------------------------------------------------------------------- /push/libs/MiPush_SDK_Client_3_1_2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/libs/MiPush_SDK_Client_3_1_2.jar -------------------------------------------------------------------------------- /push/src/main/res/drawable-hdpi/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-hdpi/send.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-hdpi/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-hdpi/start.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-hdpi/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-hdpi/upload.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-hdpi/pushnotify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-hdpi/pushnotify.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_cancel.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_list_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_list_icon.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_main_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_main_icon.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_progress.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_progress.9.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_no_collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_no_collection.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ab_bottom_emui.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ab_bottom_emui.9.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_background_emui.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_background_emui.9.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_btn_check_on_emui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_btn_check_on_emui.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_cancel_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_cancel_light.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_back.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_delete.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_pic_ab_number.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_pic_ab_number.9.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_btn_check_off_emui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_btn_check_off_emui.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_advance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_advance.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_collect.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_multiple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_multiple.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_refresh.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_multiple1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_ic_toolbar_multiple1.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_list_activated_emui.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_list_activated_emui.9.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_pic_ab_number_light.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_pic_ab_number_light.9.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_btn_check_off_pressed_emui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_btn_check_off_pressed_emui.png -------------------------------------------------------------------------------- /push/src/main/res/drawable-xhdpi/hwpush_btn_check_on_pressed_emui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jiang111/AndroidPush/HEAD/push/src/main/res/drawable-xhdpi/hwpush_btn_check_on_pressed_emui.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | gradlew 11 | gradlew.bat 12 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/utils/Target.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.utils; 2 | 3 | /** 4 | * Created by jiang on 2016/10/8. 5 | */ 6 | 7 | public enum Target { 8 | MIUI, EMUI, FLYME, VIVO, OPPO, JPUSH 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 26 18:23:11 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /push/src/main/res/values/hwpush_styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/utils/L.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.utils; 2 | 3 | import android.util.Log; 4 | 5 | import com.jiang.android.push.BuildConfig; 6 | 7 | /** 8 | * Created by jiang on 2016/10/11. 9 | */ 10 | 11 | public class L { 12 | private static final String TAG = "AndroidPush"; 13 | 14 | public static final boolean debug = BuildConfig.DEBUG; 15 | 16 | public static void i(String msg) { 17 | //if (debug) { 18 | Log.i(TAG, msg); 19 | //} 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/jiang/android/pushdemo/App.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.pushdemo; 2 | 3 | import android.app.Application; 4 | 5 | import com.jiang.android.push.Const; 6 | 7 | /** 8 | * Created by jiang on 2016/10/8. 9 | */ 10 | 11 | public class App extends Application { 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | Const.setMiUI_APP("2882303761517516835", "5911751629835"); 17 | Const.setFlyme_APP("110029", "9efb4973a717495bbae156ee5b66978b"); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/utils/JHandler.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.utils; 2 | 3 | import android.os.Looper; 4 | 5 | /** 6 | * Created by jiang on 2016/10/10. 7 | */ 8 | 9 | public class JHandler { 10 | private static android.os.Handler mHandler = null; 11 | 12 | public static android.os.Handler handler() { 13 | if (mHandler == null) { 14 | synchronized (JHandler.class) { 15 | mHandler = new android.os.Handler(Looper.getMainLooper()); 16 | } 17 | } 18 | return mHandler; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /push/src/main/res/layout/hwpush_icons_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /push/src/main/res/layout/hwpush_buttons_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/IPushManager.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push; 2 | 3 | import android.content.Context; 4 | 5 | import com.jiang.android.push.model.TokenModel; 6 | 7 | public interface IPushManager { 8 | void register(Context context, boolean debug, final PushInterface pushInterface); 9 | 10 | void unregister(Context context); 11 | 12 | void setPushInterface(PushInterface pushInterface); 13 | 14 | void setAlias(final Context context, String alias); 15 | 16 | TokenModel getToken(Context context); 17 | 18 | void pause(Context context); 19 | 20 | void resume(Context context); 21 | } -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/model/TokenModel.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.model; 2 | 3 | import com.jiang.android.push.utils.Target; 4 | 5 | /** 6 | * Created by jiang on 2016/10/8. 7 | */ 8 | 9 | public class TokenModel { 10 | private String mToken; 11 | private Target mTarget; 12 | 13 | public String getToken() { 14 | return mToken; 15 | } 16 | 17 | public void setToken(String mToken) { 18 | this.mToken = mToken; 19 | } 20 | 21 | public Target getTarget() { 22 | return mTarget; 23 | } 24 | 25 | public void setTarget(Target mTarget) { 26 | this.mTarget = mTarget; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /push/src/main/res/layout/hwpush_layout8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 17 | 18 | -------------------------------------------------------------------------------- /push/src/main/res/values/hwpush_colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ffffffff 4 | #ff000000 5 | #FF000000 6 | #80000000 7 | #65000000 8 | #2c9195 9 | #00bcd5 10 | #000000 11 | 12 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/jiang/androidsdk/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /push/src/main/res/values/jpush_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | -------------------------------------------------------------------------------- /push/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | android.useDeprecatedNdk=true。 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/jiang/android/pushdemo/LauncherActivity.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.pushdemo; 2 | 3 | import android.net.Uri; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.util.Log; 7 | 8 | public class LauncherActivity extends AppCompatActivity { 9 | 10 | private static final String TAG = "LauncherActivity"; 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_launcher); 16 | 17 | String scheml = getIntent().getScheme(); 18 | if (scheml.equals("custom")) { 19 | Uri uri = getIntent().getData(); 20 | Log.i(TAG, "onCreate: " + uri.getQueryParameter("aaa")); 21 | } else { 22 | String aa = getIntent().getExtras().getString("aaa"); 23 | Log.i(TAG, "onCreate: " + aa); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /push/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PushDemo 5 | Settings 6 | Hello world! 7 | 8 | 9 | 姓名: 10 | 年龄: 11 | 位置信息上报周期(min): 12 | 设置标签 13 | 删除标签 14 | 位置上报 15 | 设置周期(秒) 16 | 开启位置定时上报 17 | 关闭位置定时上报 18 | 19 | 20 | 标签1: 21 | 标签2: 22 | 请输入标签名(空则不设置) 23 | 请输入标签值 24 | 请输入待删标签名 25 | 26 | 获取标签 27 | 28 | -------------------------------------------------------------------------------- /push/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | group = 'com.github.jiang111' 4 | android { 5 | compileSdkVersion 28 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 28 10 | versionCode 5 11 | versionName "1.1.2" 12 | ndk { 13 | abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a' 14 | 15 | } 16 | manifestPlaceholders = [ 17 | JPUSH_PKGNAME: "library", 18 | JPUSH_APPKEY : "library", 19 | JPUSH_CHANNEL: "developer", 20 | PNAME : "library" 21 | ] 22 | 23 | } 24 | 25 | } 26 | 27 | dependencies { 28 | /** 29 | * flyme 30 | */ 31 | implementation 'com.android.support:support-v4:28.0.0' 32 | implementation 'com.android.volley:volley:1.1.0' 33 | implementation 'com.squareup.okhttp:okhttp:2.1.0' 34 | implementation 'com.meizu.flyme.internet:push-internal-publish:3.3.+@aar' 35 | /** 36 | * jpush 37 | */ 38 | implementation fileTree(include: ['*.jar'], dir: 'libs') 39 | implementation 'cn.jiguang:jpush:2.1.8' 40 | implementation files('libs/pushsdk_v2.3.4.jar') 41 | implementation files('libs/com.coloros.mcssdk.jar') 42 | } 43 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.jiang.android.pushdemo" 7 | minSdkVersion 18 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | ndk { 12 | abiFilters 'armeabi', 'armeabi-v7a', 'armeabi-v8a','x86' 13 | 14 | } 15 | manifestPlaceholders = [ 16 | JPUSH_PKGNAME : applicationId, 17 | JPUSH_APPKEY : "3df7e06ec9bf5e79abdc4a6a", 18 | JPUSH_CHANNEL : "develop", 19 | PNAME : applicationId 20 | ] 21 | 22 | 23 | } 24 | buildTypes { 25 | release { 26 | 27 | //混淆 28 | minifyEnabled true 29 | //优化zipAlign 30 | zipAlignEnabled true 31 | //移除无用的resource 32 | shrinkResources true 33 | 34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 35 | } 36 | } 37 | 38 | 39 | } 40 | 41 | dependencies { 42 | implementation fileTree(include: ['*.jar'], dir: 'libs') 43 | implementation 'com.android.support:appcompat-v7:28.0.0' 44 | implementation 'com.github.jiang111:RvAdapter:1.0' 45 | implementation project(':push') 46 | } 47 | -------------------------------------------------------------------------------- /push/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/jiang/androidsdk/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | -keep public class * extends android.content.BroadcastReceiver 20 | -keep class com.xiaomi.mipush.sdk.DemoMessageReceiver {*;} 21 | #可以防止一个误报的 warning 导致无法成功编译,如果编译使用的 Android 版本是 23。 22 | -dontwarn com.xiaomi.push.** 23 | # library 24 | -keep class com.jiang.android.push.**{*;} 25 | 26 | 27 | # huawei 28 | -keep class com.huawei.**{*;} 29 | -keep class com.hianalytics.android.**{*;} 30 | -keep class com.baidu.mapapi.**{*;} 31 | -dontwarn com.huawei.** 32 | 33 | # jpush 34 | -dontoptimize 35 | -dontpreverify 36 | 37 | -dontwarn cn.jpush.** 38 | -keep class cn.jpush.** { *; } 39 | #==================gson && protobuf========================== 40 | -dontwarn com.google.** 41 | -keep class com.google.gson.** {*;} 42 | -keep class com.google.protobuf.** {*;} 43 | -------------------------------------------------------------------------------- /push/src/main/res/values-zh-rCN/hwpush_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | "推送服务" 4 | "后退" 5 | "前进" 6 | "刷新" 7 | "收藏" 8 | "删除通知" 9 | "通知收藏" 10 | 通知收藏 11 | 12 | "删除" 13 | "全选" 14 | 15 | "点击收藏后,将在桌面自动生成一个“通知收藏”的图标,以后可从桌面直接点击查看。" 16 | "知道了" 17 | 18 | "取消" 19 | 20 | 21 | "是否删除所选通知?" 22 | 23 | "取消全选" 24 | "没有通知收藏" 25 | "富媒体" 26 | "正在加载,请稍候..." 27 | "收藏已达上限" 28 | "已收藏 1000 条通知信息,需要删除部分通知才能继续收藏,是否继续?" 29 | "继续" 30 | 存储消息 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/jiang/android/pushdemo/PushService.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.pushdemo; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | 6 | import com.jiang.android.push.Message; 7 | import com.jiang.android.push.PushInterface; 8 | 9 | /** 10 | * Created by jiang on 2016/10/9. 11 | */ 12 | 13 | public class PushService implements PushInterface { 14 | 15 | private static final String TAG = "PushServiceforMyOwn"; 16 | 17 | @Override 18 | public void onRegister(Context context, String registerID) { 19 | Log.i(TAG, "onRegister: " + " id: " + registerID); 20 | 21 | } 22 | 23 | @Override 24 | public void onUnRegister(Context context) { 25 | Log.i(TAG, "onUnRegister: "); 26 | 27 | } 28 | 29 | @Override 30 | public void onPaused(Context context) { 31 | Log.i(TAG, "onPaused: "); 32 | 33 | } 34 | 35 | @Override 36 | public void onResume(Context context) { 37 | Log.i(TAG, "onResume: "); 38 | 39 | } 40 | 41 | @Override 42 | public void onMessage(Context context, Message message) { 43 | Log.i(TAG, "onMessage: " + message.toString()); 44 | 45 | } 46 | 47 | @Override 48 | public void onMessageClicked(Context context, Message message) { 49 | Log.i(TAG, "onMessageClicked: " + message.toString()); 50 | 51 | } 52 | 53 | @Override 54 | public void onCustomMessage(Context context, Message message) { 55 | Log.i(TAG, "onCustomMessage: " + message.toString()); 56 | 57 | } 58 | 59 | @Override 60 | public void onAlias(Context context, String alias) { 61 | Log.i(TAG, "onAlias: " + alias); 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/PushInterface.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * warning: 7 | * 在flyme的推送中,不会回调onMessage()和onMessageClicked()方法 8 | * 在华为推送中,不会回调onMessage(),onMessageClicked()和onAlias()方法 9 | * 如上两个方法不会回调是因为设计的时候,通知栏的点击事件由后台负责控制,手机端值负责处理透传消息 10 | *

11 | * oppo中不需要自己处理,所以用不到PushInterface 12 | *

13 | * Created by jiang on 2016/10/8. 14 | */ 15 | 16 | public interface PushInterface { 17 | 18 | /** 19 | * 注册成功之后回调 20 | * 21 | * @param context 22 | * @param registerID 23 | */ 24 | void onRegister(Context context, String registerID); 25 | 26 | /** 27 | * 取消注册成功 28 | * 29 | * @param context 30 | */ 31 | void onUnRegister(Context context); 32 | 33 | /** 34 | * 暂停推送 35 | * 36 | * @param context 37 | */ 38 | void onPaused(Context context); 39 | 40 | /** 41 | * 开启推送 42 | * 43 | * @param context 44 | */ 45 | void onResume(Context context); 46 | 47 | /** 48 | * 通知下来之后 49 | * 50 | * @param context 51 | * @param message 52 | */ 53 | void onMessage(Context context, Message message); 54 | 55 | /** 56 | * 通知栏被点击之后 57 | * 58 | * @param context 59 | * @param message 60 | */ 61 | void onMessageClicked(Context context, Message message); 62 | 63 | /** 64 | * 透传消息 65 | * 66 | * @param context 67 | * @param message 68 | */ 69 | void onCustomMessage(Context context, Message message); 70 | 71 | 72 | /** 73 | * 别名设置成功的回调 74 | * 75 | * @param context 76 | * @param alias 77 | */ 78 | void onAlias(Context context, String alias); 79 | } 80 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/Message.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push; 2 | 3 | import com.jiang.android.push.utils.Target; 4 | 5 | /** 6 | * 将消息整合成Message model 7 | * Created by jiang on 2016/10/8. 8 | */ 9 | 10 | public final class Message { 11 | private int notifyID; //这个字段用于通知的消息类型,在透传中都是默认0 12 | private String messageID; 13 | private String title; 14 | private String message; 15 | private String extra; 16 | private Target target; 17 | 18 | public int getNotifyID() { 19 | return notifyID; 20 | } 21 | 22 | public void setNotifyID(int notifyID) { 23 | this.notifyID = notifyID; 24 | } 25 | 26 | public String getMessageID() { 27 | return messageID; 28 | } 29 | 30 | public void setMessageID(String messageID) { 31 | this.messageID = messageID; 32 | } 33 | 34 | public Target getTarget() { 35 | return target; 36 | } 37 | 38 | public void setTarget(Target target) { 39 | this.target = target; 40 | } 41 | 42 | public String getTitle() { 43 | return title; 44 | } 45 | 46 | public void setTitle(String title) { 47 | this.title = title; 48 | } 49 | 50 | public String getMessage() { 51 | return message; 52 | } 53 | 54 | public void setMessage(String message) { 55 | this.message = message; 56 | } 57 | 58 | public String getExtra() { 59 | return extra; 60 | } 61 | 62 | public void setExtra(String extra) { 63 | this.extra = extra; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return "Message{" + 69 | "notifyID=" + notifyID + 70 | ", messageID='" + messageID + '\'' + 71 | ", title='" + title + '\'' + 72 | ", message='" + message + '\'' + 73 | ", extra='" + extra + '\'' + 74 | ", target=" + target + 75 | '}'; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/utils/BuildProperties.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.utils; 2 | 3 | import android.os.Environment; 4 | 5 | import java.io.File; 6 | import java.io.FileInputStream; 7 | import java.io.IOException; 8 | import java.util.Collection; 9 | import java.util.Enumeration; 10 | import java.util.Map.Entry; 11 | import java.util.Properties; 12 | import java.util.Set; 13 | 14 | /** 15 | * Created by jiang on 2016/10/8. 16 | */ 17 | 18 | public class BuildProperties { 19 | 20 | private final Properties properties; 21 | 22 | private BuildProperties() throws IOException { 23 | properties = new Properties(); 24 | properties.load(new FileInputStream(new File(Environment.getRootDirectory(), "build.prop"))); 25 | } 26 | 27 | public boolean containsKey(final Object key) { 28 | return properties.containsKey(key); 29 | } 30 | 31 | public boolean containsValue(final Object value) { 32 | return properties.containsValue(value); 33 | } 34 | 35 | public Set> entrySet() { 36 | return properties.entrySet(); 37 | } 38 | 39 | public String getProperty(final String name) { 40 | return properties.getProperty(name); 41 | } 42 | 43 | public String getProperty(final String name, final String defaultValue) { 44 | return properties.getProperty(name, defaultValue); 45 | } 46 | 47 | public boolean isEmpty() { 48 | return properties.isEmpty(); 49 | } 50 | 51 | public Enumeration keys() { 52 | return properties.keys(); 53 | } 54 | 55 | public Set keySet() { 56 | return properties.keySet(); 57 | } 58 | 59 | public int size() { 60 | return properties.size(); 61 | } 62 | 63 | public Collection values() { 64 | return properties.values(); 65 | } 66 | 67 | public static BuildProperties newInstance() throws IOException { 68 | return new BuildProperties(); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /push/src/main/res/layout/hwpush_collect_tip_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 26 | 27 | 37 | 38 | 39 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /push/src/main/res/values/hwpush_strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Back 5 | Forward 6 | Refresh 7 | Favorite 8 | Delete notifications 9 | Favorites 10 | Favorite notifications 11 | 12 | Delete 13 | Select all 14 | 15 | A Favorites icon will be created on the home screen. You can touch the icon to view all your favorite notifications. 16 | OK 17 | 18 | Cancel 19 | 20 | 21 | Delete selected notification? 22 | 23 | Delete selected notifications? 24 | 25 | Deselect all 26 | No favorite notifications 27 | Push Service 28 | Rich media 29 | Loading... Please wait. 30 | Note 31 | A maximum of 1000 favorite notifications can be saved. Delete some notifications before you can add new ones. Go to your favorite notifications list? 32 | Go 33 | Store messages 34 | 35 | successRateAnalytics 36 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/vivo/PushMessageReceiverImpl.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.vivo; 2 | 3 | import android.content.Context; 4 | import android.text.TextUtils; 5 | import android.util.Log; 6 | 7 | import com.jiang.android.push.Message; 8 | import com.jiang.android.push.PushInterface; 9 | import com.jiang.android.push.utils.JHandler; 10 | import com.jiang.android.push.utils.JsonUtils; 11 | import com.jiang.android.push.utils.Target; 12 | import com.vivo.push.model.UPSNotificationMessage; 13 | import com.vivo.push.sdk.OpenClientPushMessageReceiver; 14 | 15 | public class PushMessageReceiverImpl extends OpenClientPushMessageReceiver { 16 | 17 | 18 | private static PushInterface mPushInterface; 19 | private String mMessage; 20 | 21 | /** 22 | * @param pushInterface 23 | */ 24 | public static void registerInterface(PushInterface pushInterface) { 25 | 26 | mPushInterface = pushInterface; 27 | } 28 | 29 | public static PushInterface getPushInterface() { 30 | return mPushInterface; 31 | } 32 | 33 | 34 | @Override 35 | public void onNotificationMessageClicked(final Context context, UPSNotificationMessage message) { 36 | mMessage = message.getContent(); 37 | 38 | if (mPushInterface != null) { 39 | final Message result = new Message(); 40 | result.setNotifyID(1); 41 | result.setMessageID(String.valueOf(message.getMsgId())); 42 | result.setTitle(message.getTitle()); 43 | result.setMessage(mMessage); 44 | result.setTarget(Target.MIUI); 45 | try { 46 | result.setExtra(JsonUtils.setJson(message.getParams()).toString()); 47 | } catch (Exception e) { 48 | Log.e(TAG, "onNotificationMessageClicked: " + e.toString()); 49 | result.setExtra("{}"); 50 | } 51 | JHandler.handler().post(new Runnable() { 52 | @Override 53 | public void run() { 54 | mPushInterface.onMessageClicked(context, result); 55 | } 56 | }); 57 | } 58 | } 59 | 60 | @Override 61 | public void onReceiveRegId(Context context, String s) { 62 | if (mPushInterface != null) { 63 | Message message = new Message(); 64 | message.setMessage(s); 65 | mPushInterface.onMessage(context, message); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | 22 | 23 | 30 | 31 | 38 | 45 | 52 | 53 | 57 | 58 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/flyme/FlymePushManager.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.flyme; 2 | 3 | import android.content.Context; 4 | 5 | import com.jiang.android.push.Const; 6 | import com.jiang.android.push.IPushManager; 7 | import com.jiang.android.push.PushInterface; 8 | import com.jiang.android.push.model.TokenModel; 9 | import com.jiang.android.push.utils.RomUtil; 10 | import com.meizu.cloud.pushsdk.PushManager; 11 | 12 | public class FlymePushManager implements IPushManager { 13 | @Override 14 | public void register(Context context, boolean debug, PushInterface pushInterface) { 15 | if (pushInterface != null) { 16 | FlymeReceiver.registerInterface(pushInterface); 17 | } 18 | PushManager.register(context, Const.getFlyme_app_id(), Const.getFlyme_app_key()); 19 | } 20 | 21 | @Override 22 | public void unregister(Context context) { 23 | FlymeReceiver.clearPushInterface(); 24 | PushManager.unRegister(context, Const.getFlyme_app_id(), Const.getFlyme_app_key()); 25 | } 26 | 27 | @Override 28 | public void setPushInterface(PushInterface pushInterface) { 29 | if (pushInterface != null) { 30 | FlymeReceiver.registerInterface(pushInterface); 31 | } 32 | } 33 | 34 | @Override 35 | public void setAlias(Context context, String alias) { 36 | PushManager.subScribeAlias(context, Const.getFlyme_app_id(), Const.getFlyme_app_key(), getToken(context).getToken(), alias); 37 | 38 | } 39 | 40 | @Override 41 | public TokenModel getToken(Context context) { 42 | if (context == null) 43 | return null; 44 | TokenModel result = new TokenModel(); 45 | result.setTarget(RomUtil.rom()); 46 | result.setToken(PushManager.getPushId(context)); 47 | return result; 48 | } 49 | 50 | @Override 51 | public void pause(Context context) { 52 | PushManager.unRegister(context, Const.getFlyme_app_id(), Const.getFlyme_app_key()); 53 | if (FlymeReceiver.getPushInterface() != null) { 54 | FlymeReceiver.getPushInterface().onPaused(context); 55 | } 56 | } 57 | 58 | @Override 59 | public void resume(Context context) { 60 | PushManager.register(context, Const.getMiui_app_id(), Const.getFlyme_app_key()); 61 | if (FlymeReceiver.getPushInterface() != null) { 62 | FlymeReceiver.getPushInterface().onResume(context); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/emui/EMPushManager.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.emui; 2 | 3 | import android.content.Context; 4 | 5 | import com.huawei.android.pushagent.api.PushManager; 6 | import com.jiang.android.push.IPushManager; 7 | import com.jiang.android.push.PushInterface; 8 | import com.jiang.android.push.model.TokenModel; 9 | import com.jiang.android.push.utils.RomUtil; 10 | import com.jiang.android.push.utils.Target; 11 | 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | public class EMPushManager implements IPushManager { 16 | @Override 17 | public void register(Context context, boolean debug, PushInterface pushInterface) { 18 | if (pushInterface != null) { 19 | EMHuaweiPushReceiver.registerInterface(pushInterface); 20 | } 21 | PushManager.requestToken(context); 22 | 23 | } 24 | 25 | @Override 26 | public void unregister(Context context) { 27 | EMHuaweiPushReceiver.clearPushInterface(); 28 | PushManager.deregisterToken(context, getToken(context).getToken()); 29 | 30 | } 31 | 32 | @Override 33 | public void setPushInterface(PushInterface pushInterface) { 34 | if (pushInterface != null) { 35 | EMHuaweiPushReceiver.registerInterface(pushInterface); 36 | } 37 | } 38 | 39 | @Override 40 | public void setAlias(Context context, String alias) { 41 | Map tag = new HashMap<>(); 42 | tag.put("name", alias); 43 | PushManager.setTags(context, tag); 44 | } 45 | 46 | @Override 47 | public TokenModel getToken(Context context) { 48 | if (context == null) 49 | return null; 50 | TokenModel result = new TokenModel(); 51 | result.setTarget(RomUtil.rom()); 52 | result.setToken(EMHuaweiPushReceiver.getmToken()); 53 | return result; 54 | } 55 | 56 | @Override 57 | public void pause(Context context) { 58 | PushManager.enableReceiveNormalMsg(context, false); 59 | PushManager.enableReceiveNotifyMsg(context, false); 60 | if (EMHuaweiPushReceiver.getPushInterface() != null) { 61 | EMHuaweiPushReceiver.getPushInterface().onPaused(context); 62 | } 63 | 64 | } 65 | 66 | @Override 67 | public void resume(Context context) { 68 | PushManager.enableReceiveNormalMsg(context, true); 69 | PushManager.enableReceiveNotifyMsg(context, true); 70 | if (EMHuaweiPushReceiver.getPushInterface() != null) { 71 | EMHuaweiPushReceiver.getPushInterface().onResume(context); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/jpush/JPushManager.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.jpush; 2 | 3 | import android.content.Context; 4 | 5 | import com.jiang.android.push.IPushManager; 6 | import com.jiang.android.push.PushInterface; 7 | import com.jiang.android.push.model.TokenModel; 8 | import com.jiang.android.push.utils.L; 9 | import com.jiang.android.push.utils.RomUtil; 10 | 11 | import java.util.Set; 12 | 13 | import cn.jpush.android.api.JPushInterface; 14 | import cn.jpush.android.api.TagAliasCallback; 15 | 16 | public class JPushManager implements IPushManager { 17 | @Override 18 | public void register(Context context, boolean debug, PushInterface pushInterface) { 19 | if (pushInterface != null) { 20 | JPushReceiver.registerInterface(pushInterface); 21 | } 22 | JPushInterface.init(context); 23 | JPushInterface.setDebugMode(debug); 24 | } 25 | 26 | @Override 27 | public void unregister(Context context) { 28 | JPushReceiver.clearPushInterface(); 29 | JPushInterface.stopPush(context); 30 | } 31 | 32 | @Override 33 | public void setPushInterface(PushInterface pushInterface) { 34 | if (pushInterface != null) { 35 | JPushReceiver.registerInterface(pushInterface); 36 | } 37 | } 38 | 39 | @Override 40 | public void setAlias(final Context context, String alias) { 41 | JPushInterface.setAlias(context, alias, new TagAliasCallback() { 42 | @Override 43 | public void gotResult(int i, String s, Set set) { 44 | if (i == 0) { // 这里极光规定0代表成功 45 | if (JPushReceiver.getPushInterface() != null) { 46 | L.i("JPushInterface.setAlias"); 47 | JPushReceiver.getPushInterface().onAlias(context, s); 48 | 49 | } 50 | } 51 | } 52 | }); 53 | } 54 | 55 | @Override 56 | public TokenModel getToken(Context context) { 57 | if (context == null) 58 | return null; 59 | TokenModel result = new TokenModel(); 60 | result.setTarget(RomUtil.rom()); 61 | result.setToken(JPushInterface.getRegistrationID(context)); 62 | return result; 63 | } 64 | 65 | @Override 66 | public void pause(Context context) { 67 | if (!JPushInterface.isPushStopped(context)) { 68 | JPushInterface.stopPush(context); 69 | if (JPushReceiver.getPushInterface() != null) { 70 | JPushReceiver.getPushInterface().onPaused(context); 71 | } 72 | } 73 | } 74 | 75 | @Override 76 | public void resume(Context context) { 77 | if (JPushInterface.isPushStopped(context)) { 78 | JPushInterface.resumePush(context); 79 | if (JPushReceiver.getPushInterface() != null) { 80 | JPushReceiver.getPushInterface().onResume(context); 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/vivo/ViVOPushManager.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push.vivo; 2 | 3 | import android.content.Context; 4 | 5 | import com.jiang.android.push.IPushManager; 6 | import com.jiang.android.push.PushInterface; 7 | import com.jiang.android.push.model.TokenModel; 8 | import com.jiang.android.push.utils.RomUtil; 9 | import com.vivo.push.IPushActionListener; 10 | import com.vivo.push.PushClient; 11 | 12 | public class ViVOPushManager implements IPushManager { 13 | @Override 14 | public void register(Context context, boolean debug, final PushInterface pushInterface) { 15 | // 在当前工程入口函数,建议在 Application 的 onCreate 函数中,添加以下代码: 16 | PushClient.getInstance(context).initialize(); 17 | // 当需要打开推送服务时,调用以下代码: 18 | PushClient.getInstance(context).turnOnPush(new IPushActionListener() { 19 | @Override 20 | public void onStateChanged(int i) { 21 | if (i == 0 && pushInterface != null) { 22 | PushMessageReceiverImpl.registerInterface(pushInterface); 23 | } 24 | 25 | } 26 | }); 27 | } 28 | 29 | @Override 30 | public void unregister(Context context) { 31 | PushClient.getInstance(context).turnOffPush(new IPushActionListener() { 32 | @Override 33 | public void onStateChanged(int i) { 34 | if (i == 0) { 35 | PushMessageReceiverImpl.registerInterface(null); 36 | } 37 | 38 | } 39 | }); 40 | 41 | } 42 | 43 | @Override 44 | public void setPushInterface(PushInterface pushInterface) { 45 | PushMessageReceiverImpl.registerInterface(pushInterface); 46 | 47 | } 48 | 49 | @Override 50 | public void setAlias(Context context, String alias) { 51 | PushClient.getInstance(context).bindAlias(alias, new IPushActionListener() { 52 | @Override 53 | public void onStateChanged(int i) { 54 | 55 | } 56 | }); 57 | } 58 | 59 | @Override 60 | public TokenModel getToken(Context context) { 61 | TokenModel result = new TokenModel(); 62 | result.setTarget(RomUtil.rom()); 63 | result.setToken(PushClient.getInstance(context).getRegId()); 64 | 65 | return result; 66 | } 67 | 68 | @Override 69 | public void pause(Context context) { 70 | 71 | PushClient.getInstance(context).turnOffPush(new IPushActionListener() { 72 | @Override 73 | public void onStateChanged(int i) { 74 | 75 | } 76 | }); 77 | if (PushMessageReceiverImpl.getPushInterface() != null) { 78 | PushMessageReceiverImpl.getPushInterface().onPaused(context); 79 | } 80 | } 81 | 82 | @Override 83 | public void resume(Context context) { 84 | register(context, false, null); 85 | if (PushMessageReceiverImpl.getPushInterface() != null) { 86 | PushMessageReceiverImpl.getPushInterface().onResume(context); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /push/src/main/java/com/jiang/android/push/Const.java: -------------------------------------------------------------------------------- 1 | package com.jiang.android.push; 2 | 3 | import android.text.TextUtils; 4 | 5 | /** 6 | * Created by jiang on 2016/10/8. 7 | */ 8 | 9 | public class Const { 10 | 11 | private static String miui_app_id = null; 12 | private static String miui_app_key = null; 13 | private static String flyme_app_id = null; 14 | private static String flyme_app_key = null; 15 | private static String color_app_key = null; 16 | private static String color_app_secret = null; 17 | 18 | public static String getMiui_app_id() { 19 | if (TextUtils.isEmpty(miui_app_id)) { 20 | throw new NullPointerException("please config miui_app_id before use it"); 21 | } 22 | return miui_app_id; 23 | } 24 | 25 | public static String getMiui_app_key() { 26 | if (TextUtils.isEmpty(miui_app_key)) { 27 | throw new NullPointerException("please config miui_app_key before use it"); 28 | } 29 | return miui_app_key; 30 | } 31 | 32 | public static String getFlyme_app_id() { 33 | if (TextUtils.isEmpty(flyme_app_id)) { 34 | throw new NullPointerException("please config flyme_app_id before use it"); 35 | } 36 | return flyme_app_id; 37 | } 38 | 39 | public static String getFlyme_app_key() { 40 | if (TextUtils.isEmpty(flyme_app_key)) { 41 | throw new NullPointerException("please config flyme_app_key before use it"); 42 | } 43 | return flyme_app_key; 44 | } 45 | 46 | 47 | public static void setMiUI_APP(String miui_app_id, String miui_app_key) { 48 | setMiui_app_id(miui_app_id); 49 | setMiui_app_key(miui_app_key); 50 | } 51 | 52 | public static void setFlyme_APP(String flyme_app_id, String flyme_app_key) { 53 | setFlyme_app_id(flyme_app_id); 54 | setFlyme_app_key(flyme_app_key); 55 | } 56 | 57 | public static void setColor_APP(String app_key, String app_secret) { 58 | Const.color_app_key = app_key; 59 | Const.color_app_secret = app_secret; 60 | } 61 | 62 | public static String getColor_app_key() { 63 | if (TextUtils.isEmpty(color_app_key)) { 64 | throw new NullPointerException("please config color_app_key before use it"); 65 | } 66 | return color_app_key; 67 | } 68 | 69 | public static String getColor_app_secret() { 70 | if (TextUtils.isEmpty(color_app_secret)) { 71 | throw new NullPointerException("please config color_app_secret before use it"); 72 | } 73 | return color_app_secret; 74 | } 75 | 76 | private static void setMiui_app_id(String miui_app_id) { 77 | Const.miui_app_id = miui_app_id; 78 | } 79 | 80 | private static void setMiui_app_key(String miui_app_key) { 81 | Const.miui_app_key = miui_app_key; 82 | } 83 | 84 | private static void setFlyme_app_id(String flyme_app_id) { 85 | Const.flyme_app_id = flyme_app_id; 86 | } 87 | 88 | private static void setFlyme_app_key(String flyme_app_key) { 89 | Const.flyme_app_key = flyme_app_key; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /push/src/main/res/layout/hwpush_collection_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 23 | 24 | 37 | 38 | 52 | 53 | 64 | 65 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /push/src/main/res/layout/hwpush_layout4.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 27 | 28 | 37 | 38 | 48 | 49 | 55 | 56 | 61 | 62 | 63 | 64 | 65 |