├── .gitignore ├── LICENSE ├── README.md ├── doc └── sdk_model.png ├── package.json ├── plugin.xml ├── src ├── android │ ├── JCorePlugin.java │ └── jcore-android-5.0.0.jar └── ios │ └── jcore-ios-5.0.1.xcframework │ ├── Info.plist │ ├── ios-arm64 │ ├── Headers │ │ ├── JGCOREAPI.h │ │ └── JGInforCollectionAuth.h │ ├── PrivacyInfo.xcprivacy │ └── libJCore.a │ └── ios-arm64_x86_64-simulator │ ├── Headers │ ├── JGCOREAPI.h │ └── JGInforCollectionAuth.h │ ├── PrivacyInfo.xcprivacy │ └── libJCore.a └── www └── jcore.js /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | \.DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 极光开发者 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cordova Plugin JCore 2 | 3 | [![release](https://img.shields.io/badge/release-1.2.1-blue.svg)](https://github.com/jpush/jpush-phonegap-plugin/releases) 4 | [![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-lightgrey.svg)](https://github.com/jpush/jpush-phonegap-plugin) 5 | [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1) 6 | 7 | 极光各种开发者服务的核心依赖 JCore SDK 的 Cordova 插件。 8 | 9 | 极光开发者服务及对应的 Cordova 插件如下: 10 | 11 | - 极光推送(JPush)- [jpush-phonegap-plugin](https://github.com/jpush/jpush-phonegap-plugin) 12 | - 极光 IM(JMessage)- [jmessage-phonegap-plugin](https://github.com/jpush/jmessage-phonegap-plugin) 13 | - 极光统计(JAnalytics)- [cordova-plugn-janalytics](https://github.com/jpush/cordova-plugin-janalytics) 14 | - 极光短信验证码(JSMS)- [cordova-plugin-jsms](https://github.com/jpush/cordova-plugin-jsms) 15 | 16 | **v1.2.1** 对应的 jcore 版本: 17 | 18 | - Android: v1.2.1 19 | - iOS: v1.1.6 20 | 21 | **v1.3.2** 对应的 jcore 版本: 22 | 23 | - Android: v2.3.2 24 | - iOS: v2.2.4 25 | 26 | 注意:从 v1.2.0 版本开始支持 cordova-android 7.0.0。 27 | 28 | ## 什么是 JCore 29 | 30 | 极光开发者服务 SDK 采用了模块化的使用模式,即一个核心(JCore)+ N 种服务(JPush,JMessage...)的使用方式,方便开发者使用某一项服务或多项服务,极大的优化了多模块同时使用时功能模块重复的问题。如下图: 31 | 32 | ![](doc/sdk_model.png) 33 | 34 | ## Install 35 | 36 | cordova-plugin-jcore 作为其他极光 Cordova 插件的依赖,在安装其他插件时会自动安装。 37 | 38 | ## Support 39 | 40 | - [极光社区](http://community.jiguang.cn/) 41 | - QQ 交流群:413602425 42 | 43 | ## License 44 | 45 | MIT © [JiGuang](/license) 46 | -------------------------------------------------------------------------------- /doc/sdk_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/cordova-plugin-jcore/fd7e10fddd86e28d0933bc270cd3fb41f64d161c/doc/sdk_model.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-jcore", 3 | "version": "5.0.0", 4 | "description": "jcore for cordova plugin", 5 | "cordova": { 6 | "id": "cordova-plugin-jcore", 7 | "platforms": [ 8 | "android", 9 | "ios" 10 | ] 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/jpush/cordova-plugin-jcore" 15 | }, 16 | "keywords": [ 17 | "jcore", 18 | "jpush", 19 | "ecosystem:cordova", 20 | "cordova-android", 21 | "cordova-ios" 22 | ], 23 | "author": "wilhantian, jiguang", 24 | "license": "MIT License", 25 | "bugs": { 26 | "url": "https://github.com/jpush/cordova-plugin-jcore/issues" 27 | }, 28 | "homepage": "https://github.com/jpush/cordova-plugin-jcore#readme" 29 | } 30 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | JCore 8 | Cordova plugin for jcore 9 | WilhanTian, JiGuang 10 | jcore,jpush 11 | MIT License 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/android/JCorePlugin.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.cordova.jcore; 2 | import android.content.Context; 3 | import android.content.res.Resources; 4 | import android.util.Log; 5 | 6 | import org.apache.cordova.CallbackContext; 7 | import org.apache.cordova.CordovaInterface; 8 | import org.apache.cordova.CordovaPlugin; 9 | import org.apache.cordova.CordovaWebView; 10 | import org.apache.cordova.PluginResult; 11 | import org.json.JSONArray; 12 | import org.json.JSONException; 13 | import org.json.JSONObject; 14 | 15 | import java.lang.reflect.Method; 16 | import java.util.Iterator; 17 | import cn.jiguang.api.utils.JCollectionAuth; 18 | import cn.jiguang.api.JCoreInterface; 19 | public class JCorePlugin extends CordovaPlugin { 20 | private static final String TAG = "JCorePlugin"; 21 | private Context mContext; 22 | 23 | @Override 24 | public void initialize(CordovaInterface cordova, CordovaWebView webView) { 25 | super.initialize(cordova, webView); 26 | mContext = cordova.getActivity().getApplicationContext(); 27 | } 28 | 29 | @Override 30 | public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext) throws JSONException { 31 | Log.d(TAG, "execute:" + action); 32 | cordova.getThreadPool().execute(new Runnable() { 33 | @Override 34 | public void run() { 35 | try { 36 | Method method = JCorePlugin.class.getDeclaredMethod(action, JSONArray.class, 37 | CallbackContext.class); 38 | method.invoke(JCorePlugin.this, args, callbackContext); 39 | } catch (Throwable e) { 40 | e.printStackTrace(); 41 | Log.e(TAG, e.toString()); 42 | } 43 | } 44 | }); 45 | return true; 46 | } 47 | 48 | void testCountryCode(JSONArray jsonArray,CallbackContext callbackContext){ 49 | 50 | try { 51 | String code = jsonArray.getString(0); 52 | JCoreInterface.testCountryCode(mContext,code); 53 | }catch (Throwable throwable){ 54 | } 55 | } 56 | void setAuth(JSONArray jsonArray,CallbackContext callbackContext){ 57 | 58 | try { 59 | boolean enable = jsonArray.getBoolean(0); 60 | 61 | JCollectionAuth.setAuth(mContext,enable); 62 | }catch (Throwable throwable){ 63 | 64 | } 65 | } 66 | void enableAutoWakeup(JSONArray jsonArray,CallbackContext callbackContext){ 67 | 68 | try { 69 | boolean enable = jsonArray.getBoolean(0); 70 | 71 | JCollectionAuth.enableAutoWakeup(mContext,enable); 72 | }catch (Throwable throwable){ 73 | 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/android/jcore-android-5.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/cordova-plugin-jcore/fd7e10fddd86e28d0933bc270cd3fb41f64d161c/src/android/jcore-android-5.0.0.jar -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AvailableLibraries 6 | 7 | 8 | HeadersPath 9 | Headers 10 | LibraryIdentifier 11 | ios-arm64_x86_64-simulator 12 | LibraryPath 13 | libJCore.a 14 | SupportedArchitectures 15 | 16 | arm64 17 | x86_64 18 | 19 | SupportedPlatform 20 | ios 21 | SupportedPlatformVariant 22 | simulator 23 | 24 | 25 | HeadersPath 26 | Headers 27 | LibraryIdentifier 28 | ios-arm64 29 | LibraryPath 30 | libJCore.a 31 | SupportedArchitectures 32 | 33 | arm64 34 | 35 | SupportedPlatform 36 | ios 37 | 38 | 39 | CFBundlePackageType 40 | XFWK 41 | XCFrameworkFormatVersion 42 | 1.0 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64/Headers/JGCOREAPI.h: -------------------------------------------------------------------------------- 1 | // 2 | // JGCOREService.h 3 | // JCore 4 | // 5 | // Created by Shuni Huang on 2024/3/19. 6 | // Copyright © 2024 jiguang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface JGCOREAPI : NSObject 14 | 15 | + (void)ci:(BOOL)enable; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64/Headers/JGInforCollectionAuth.h: -------------------------------------------------------------------------------- 1 | // 2 | // JGInforCollectionAuth.h 3 | // JCore 4 | // 5 | // Created by 豆瓣 on 2021/10/27. 6 | // Copyright © 2021 jiguang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | /// 合规接口,是否授权极光采集一定的设备信息 14 | @interface JGInforCollectionAuthItems : NSObject 15 | /// 是否授权,默认YES 16 | @property(nonatomic,assign)BOOL isAuth; 17 | @end 18 | 19 | @interface JGInforCollectionAuth : NSObject 20 | 21 | /// 设备信息采集授权接口(合规接口) 22 | /// 请务必在调用初始化、功能性接口前调用此接口进行合规授权 23 | /// @param authBlock auth:YES 则极光认为您同意极光采集一定的设备信息 24 | +(void)JCollectionAuth:(void(^_Nullable)(JGInforCollectionAuthItems *authInfo))authBlock; 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTrackingDomains 6 | 7 | NSPrivacyCollectedDataTypes 8 | 9 | 10 | NSPrivacyCollectedDataType 11 | NSPrivacyCollectedDataTypeCrashData 12 | NSPrivacyCollectedDataTypeLinked 13 | 14 | NSPrivacyCollectedDataTypeTracking 15 | 16 | NSPrivacyCollectedDataTypePurposes 17 | 18 | NSPrivacyCollectedDataTypePurposeAppFunctionality 19 | 20 | 21 | 22 | NSPrivacyCollectedDataType 23 | NSPrivacyCollectedDataTypeDeviceID 24 | NSPrivacyCollectedDataTypeLinked 25 | 26 | NSPrivacyCollectedDataTypeTracking 27 | 28 | NSPrivacyCollectedDataTypePurposes 29 | 30 | NSPrivacyCollectedDataTypePurposeAppFunctionality 31 | 32 | 33 | 34 | NSPrivacyCollectedDataType 35 | NSPrivacyCollectedDataTypePreciseLocation 36 | NSPrivacyCollectedDataTypeLinked 37 | 38 | NSPrivacyCollectedDataTypeTracking 39 | 40 | NSPrivacyCollectedDataTypePurposes 41 | 42 | NSPrivacyCollectedDataTypePurposeAppFunctionality 43 | 44 | 45 | 46 | NSPrivacyTracking 47 | 48 | NSPrivacyAccessedAPITypes 49 | 50 | 51 | NSPrivacyAccessedAPITypeReasons 52 | 53 | E174.1 54 | 55 | NSPrivacyAccessedAPIType 56 | NSPrivacyAccessedAPICategoryDiskSpace 57 | 58 | 59 | NSPrivacyAccessedAPITypeReasons 60 | 61 | CA92.1 62 | 63 | NSPrivacyAccessedAPIType 64 | NSPrivacyAccessedAPICategoryUserDefaults 65 | 66 | 67 | NSPrivacyAccessedAPITypeReasons 68 | 69 | C617.1 70 | 71 | NSPrivacyAccessedAPIType 72 | NSPrivacyAccessedAPICategoryFileTimestamp 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64/libJCore.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/cordova-plugin-jcore/fd7e10fddd86e28d0933bc270cd3fb41f64d161c/src/ios/jcore-ios-5.0.1.xcframework/ios-arm64/libJCore.a -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGCOREAPI.h: -------------------------------------------------------------------------------- 1 | // 2 | // JGCOREService.h 3 | // JCore 4 | // 5 | // Created by Shuni Huang on 2024/3/19. 6 | // Copyright © 2024 jiguang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface JGCOREAPI : NSObject 14 | 15 | + (void)ci:(BOOL)enable; 16 | 17 | @end 18 | 19 | NS_ASSUME_NONNULL_END 20 | -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64_x86_64-simulator/Headers/JGInforCollectionAuth.h: -------------------------------------------------------------------------------- 1 | // 2 | // JGInforCollectionAuth.h 3 | // JCore 4 | // 5 | // Created by 豆瓣 on 2021/10/27. 6 | // Copyright © 2021 jiguang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | /// 合规接口,是否授权极光采集一定的设备信息 14 | @interface JGInforCollectionAuthItems : NSObject 15 | /// 是否授权,默认YES 16 | @property(nonatomic,assign)BOOL isAuth; 17 | @end 18 | 19 | @interface JGInforCollectionAuth : NSObject 20 | 21 | /// 设备信息采集授权接口(合规接口) 22 | /// 请务必在调用初始化、功能性接口前调用此接口进行合规授权 23 | /// @param authBlock auth:YES 则极光认为您同意极光采集一定的设备信息 24 | +(void)JCollectionAuth:(void(^_Nullable)(JGInforCollectionAuthItems *authInfo))authBlock; 25 | @end 26 | 27 | NS_ASSUME_NONNULL_END 28 | -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64_x86_64-simulator/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTrackingDomains 6 | 7 | NSPrivacyCollectedDataTypes 8 | 9 | 10 | NSPrivacyCollectedDataType 11 | NSPrivacyCollectedDataTypeCrashData 12 | NSPrivacyCollectedDataTypeLinked 13 | 14 | NSPrivacyCollectedDataTypeTracking 15 | 16 | NSPrivacyCollectedDataTypePurposes 17 | 18 | NSPrivacyCollectedDataTypePurposeAppFunctionality 19 | 20 | 21 | 22 | NSPrivacyCollectedDataType 23 | NSPrivacyCollectedDataTypeDeviceID 24 | NSPrivacyCollectedDataTypeLinked 25 | 26 | NSPrivacyCollectedDataTypeTracking 27 | 28 | NSPrivacyCollectedDataTypePurposes 29 | 30 | NSPrivacyCollectedDataTypePurposeAppFunctionality 31 | 32 | 33 | 34 | NSPrivacyCollectedDataType 35 | NSPrivacyCollectedDataTypePreciseLocation 36 | NSPrivacyCollectedDataTypeLinked 37 | 38 | NSPrivacyCollectedDataTypeTracking 39 | 40 | NSPrivacyCollectedDataTypePurposes 41 | 42 | NSPrivacyCollectedDataTypePurposeAppFunctionality 43 | 44 | 45 | 46 | NSPrivacyTracking 47 | 48 | NSPrivacyAccessedAPITypes 49 | 50 | 51 | NSPrivacyAccessedAPITypeReasons 52 | 53 | E174.1 54 | 55 | NSPrivacyAccessedAPIType 56 | NSPrivacyAccessedAPICategoryDiskSpace 57 | 58 | 59 | NSPrivacyAccessedAPITypeReasons 60 | 61 | CA92.1 62 | 63 | NSPrivacyAccessedAPIType 64 | NSPrivacyAccessedAPICategoryUserDefaults 65 | 66 | 67 | NSPrivacyAccessedAPITypeReasons 68 | 69 | C617.1 70 | 71 | NSPrivacyAccessedAPIType 72 | NSPrivacyAccessedAPICategoryFileTimestamp 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/ios/jcore-ios-5.0.1.xcframework/ios-arm64_x86_64-simulator/libJCore.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/cordova-plugin-jcore/fd7e10fddd86e28d0933bc270cd3fb41f64d161c/src/ios/jcore-ios-5.0.1.xcframework/ios-arm64_x86_64-simulator/libJCore.a -------------------------------------------------------------------------------- /www/jcore.js: -------------------------------------------------------------------------------- 1 | var exec = require('cordova/exec') 2 | 3 | exports.coolMethod = function (arg0, success, error) { 4 | exec(success, error, 'jcore', 'coolMethod', [arg0]) 5 | } 6 | module.exports = { 7 | testCountryCode: function (code) { 8 | if(device.platform === "Android"){ 9 | exec(null, null, "JCorePlugin", 'testCountryCode', [code]); 10 | } 11 | }, 12 | setAuth: function (enable) { 13 | if(device.platform === "Android"){ 14 | exec(null, null, "JCorePlugin", 'setAuth', [enable]); 15 | } 16 | }, 17 | enableAutoWakeup: function (enable) { 18 | if(device.platform === "Android"){ 19 | exec(null, null, "JCorePlugin", 'enableAutoWakeup', [enable]); 20 | } 21 | } 22 | } --------------------------------------------------------------------------------