# bp_aliyun_push **Repository Path**: fengxinsen/bp_aliyun_push ## Basic Information - **Project Name**: bp_aliyun_push - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-03-15 - **Last Updated**: 2021-09-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### bp_aliyun_push 阿里云推送,安卓支持厂商推送,使用方便,只需要三个步骤 使用步骤: dart: 1.pubspec.yaml添加依赖 ```yaml bp_aliyun_push: git: https://gitee.com/fengxinsen/bp_aliyun_push.git ``` 2.添加监听 ```dart BpAliyunPush.onReceive( onReceiveNotification: (res) { print(res); }, ); ``` 原生集成步骤: android: 1.配置信息 android目录下的app目录下的build.gradle文件中 defaultConfig下添加 ```groovy defaultConfig { applicationId "com.xxx.yyy" minSdkVersion 21 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName manifestPlaceholders = [ aliyunPushAppKey : "", //阿里云推送appkey aliyunPushAppSecret : "",//阿里云推送appsecret pushChannelId : "\\123", //安卓8.0后推送需指定渠道id,后台发送推送需要指定相同值(配置中纯数字需要加\\反斜线) pushChannelName : "", //安卓8.0后推送需指定用户可以看到的通知渠道的名字.,后台发送推送需要指定相同值(配置中纯数字需要加\\反斜线) pushChannelDescription: "", //安卓8.0后推送需指定用户可以看到的通知渠道的描述.,后台发送推送需要指定相同值(配置中纯数字需要加\\反斜线) miPushAppId : "\\123", //小米推送Appid (配置中纯数字需要加\\反斜线) miPushAppKey : "\\123", //小米推送AppKey (配置中纯数字需要加\\反斜线) huaweiPushAppId : "", //华为推送AppId (配置中纯数字需要加\\反斜线) oppoPushAppKey : "123", //oppo推送AppKey (配置中纯数字需要加\\反斜线) oppoPushAppSecret : "123", //oppo推送AppKey (配置中纯数字需要加\\反斜线) vivoPushAppId : "", //vivo推送AppId (配置中纯数字需要加\\反斜线) vivoPushAppKey : "", //vivo推送AppKey (配置中纯数字需要加\\反斜线) meizhuPushAppId : "", //魅族推送AppId (配置中纯数字需要加\\反斜线) meizhuPushAppKey : "",//魅族推送AppKey (配置中纯数字需要加\\反斜线) ] } ``` 2.初始化推送 自定义App Application继承FlutterApplication > onCreate 中调用,FlutterAliyunPushPlugin.initPush(this); ```java package com.xxx.yyy; import net.baipeng.bp_aliyun_push.BpAliyunPushPlugin; import io.flutter.app.FlutterApplication; public class FApplication extends FlutterApplication { @Override public void onCreate() { super.onCreate(); BpAliyunPushPlugin.initPush(this); } } ``` iOS: 1.初始化 在AppDelegate添加如下初始化代码: > [BpAliyunPushPlugin initKey:@"" appSecret:@""]; ```objectivec #import "AppDelegate.h" #import "GeneratedPluginRegistrant.h" #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [BpAliyunPushPlugin initKey:@"" appSecret:@""]; [GeneratedPluginRegistrant registerWithRegistry:self]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end ``` 2.Podfile ``` platform :ios, '10.0' source 'https://github.com/CocoaPods/Specs.git' source 'https://github.com/aliyun/aliyun-specs.git' ``` ios推送证书配置参考: https://help.aliyun.com/document_detail/30071.html?spm=a2c4g.11174283.6.608.43bd6d16C23L8t ```groovy defaultConfig { ndk { abiFilters "armeabi", "armeabi-v7a" , "arm64-v8a", "x86", "x86_64", "mips", "mips64" } } ``` ```groovy buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } ```