# MyJpush2 **Repository Path**: android100/MyJpush2 ## Basic Information - **Project Name**: MyJpush2 - **Description**: gradle配置极光推送 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-05-23 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ``` JIGUANG-JCore: [JCoreGobal] AndroidManifest.xml missing required service:cn.jpush.android.service.JCommonService, please custom one service and extends JCommonService ``` 需要继承JCommonService的一个service ``` JIGUANG-JCore: [CheckManifestHelper] errorcode:1008,Invalid appKey : f0e290c9820d25f38bd8320b , Please get your Appkey from JIGUANG web console! ``` 前后不要带空格 打印如下log即为成功: ``` //action:init JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.3.1, buildId:2 JIGUANG-JPush: [AndroidUtil] action:checkValidManifest JIGUANG-JCore: [JCoreHelper] runActionWithService action:init JIGUANG-JCore: [JCoreGobal] action:init jcore,version:2.0.1,build id:30 JIGUANG-JCore: [JCommonServiceHelper] found userServiceClass :com.example.push.MyJCommonService by getComponentInfo //Login succeed JIGUANG-JCore-IMPL: [ConnTask_xxx] Open connection with ip=/103.230.236.43, port:7001 JIGUANG-JCore-IMPL: [ConnTask_xxx] Succeed to open connection - ip:/103.230.236.43, port:7001 JIGUANG-JCore-IMPL: [ConnectingHelper] Register succeed - juid:25320802828, registrationId:140fe1da9ee73c74349, deviceId:null JIGUANG-JCore-IMPL: [JCoreTCPManager] resgiter success:140fe1da9ee73c74349 JIGUANG-JCore-IMPL: [ConnectingHelper] Login with - juid:25320802828, appKey:f0e290c9820d25f38bd8320b, sdkVersion:131073|197377, pluginPlatformType:0 JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:get_loc_info JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:on_register JIGUANG-JCore-IMPL: [ConnectingHelper] Login succeed - sid:41265, serverTime;1558592018000 JIGUANG-JCore-IMPL: [NetworkingClient] Network listening... JIGUANG-JCore-IMPL: [JCoreTCPManager] Action - onLoggedIn JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:periodtask JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:getwakeenable JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:filter_pkg_list JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:get_loc_info ``` 这里的版本日志为: ``` // JIGUANG D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.3.1, buildId:2 D/JIGUANG-JPush: [AndroidUtil] action:checkValidManifest D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:init I/JIGUANG-JCore: [JCoreGobal] action:init jcore,version:2.0.1,build id:30 I/JIGUANG-JCore: [JCommonServiceHelper] found userServiceClass :com.example.push.MyJCommonService by getCommonServiceNames D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:change_foreground D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:notification_state ``` 设置alias后: ``` // JIGUANG D/JIGUANG-JPush: [JPushInterface] action:init - sdkVersion:3.3.1, buildId:2 D/JIGUANG-JPush: [AndroidUtil] action:checkValidManifest D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:init I/JIGUANG-JCore: [JCoreGobal] action:init jcore,version:2.0.1,build id:30 I/JIGUANG-JCore: [JCommonServiceHelper] found userServiceClass :com.example.push.MyJCommonService by getCommonServiceNames D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:tagalis // D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:change_foreground D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:notification_state ``` 第一次安装: ``` //初始化 E/MyJpushReceiver: onRegister======120c83f760550b19c14 //只走一次 E/MyJpushReceiver: onConnected======true //getRegistrationID E/MainActivity: onCreate======120c83f760550b19c14 //必须在初始化完成后才可获取到值 //setAlias E/MyJpushReceiver: onAliasOperatorResult====== JPushMessage{alias='0x123', tags=null, checkTag='null', errorCode=0, tagCheckStateResult=false, isTagCheckOperator=false, sequence=1, mobileNumber=null} ``` 每次打开app: ``` E/MyJpushReceiver: onConnected======true //getRegistrationID E/MainActivity: onCreate======120c83f760550b19c14 ``` 发送消息: ``` E/MyJpushReceiver: onMessage======CustomMessage{messageId='20266215048396767', extra='', message='0x123 第一条消息', contentType='', title='', senderId='f0e290c9820d25f38bd8320b', appId='com.example.myjpush2'} ``` 发送通知: ``` E/MyJpushReceiver: onNotifyMessageArrived======NotificationMessage{notificationId=530318208, msgId='47287806141708961', appkey='f0e290c9820d25f38bd8320b', notificationContent='0x123 第一条通知', notificationAlertType=7, notificationTitle='MyJpush2', notificationSmallIcon='', notificationLargeIcon='', notificationExtras='{}', notificationStyle=0, notificationBuilderId=0, notificationBigText='', notificationBigPicPath='', notificationInbox='', notificationPriority=0, notificationCategory='', developerArg0='', platform=0, notificationType=0} ``` 以下写法会报错:errorCode=6022 ``` case R.id.btn4: JPushInterface.setAlias(this, 2, "0x12345"); JPushInterface.setAlias(this, 3, "0x12345"); break; ``` ![](imgs/6022.png) 请确保两次关于alias的操作在20秒之上。