提交 414a7844 authored 作者: 史晓晨's avatar 史晓晨

feat:调试Android、iOS消息推送

上级 f63f557e
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
......@@ -27,6 +27,13 @@ def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
def keystoreProperties = new Properties()
def keyPropertiesFile = rootProject.file('app/key.properties')
if (keyPropertiesFile.exists()) {
keyPropertiesFile.withReader('UTF-8') { reader ->
keystoreProperties.load(reader)
}
}
android {
compileSdkVersion flutter.compileSdkVersion
......@@ -39,7 +46,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.aliyun.emas.pocdemo"
applicationId "com.clx.carrier_driver"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
......@@ -49,20 +56,20 @@ android {
}
signingConfigs {
config {
storeFile file("Test.jks")
storePassword "test1234"
keyAlias "test"
keyPassword "test1234"
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
debug {
signingConfig signingConfigs.config
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.config
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
......
storePassword=android
keyPassword=android
keyAlias=clx-android
storeFile=../app/clx-keystore.jks
\ No newline at end of file
......@@ -8,8 +8,12 @@
<meta-data android:name="com.huawei.hms.client.appid" android:value="YOUR_HUAWEI_APP_ID" />
<!-- VIVO 推送 -->
<meta-data android:name="com.vivo.push.api_key" android:value="YOUR_VIVO_API_KEY" />
<meta-data android:name="com.vivo.push.app_id" android:value="YOUR_VIVO_APP_ID" />
<meta-data
android:name="com.vivo.push.api_key"
android:value="73f8f4e380cff48e3d56b0fbd5e3c6e4" />
<meta-data
android:name="com.vivo.push.app_id"
android:value="105797121" />
<!-- 荣耀推送 -->
<meta-data android:name="com.hihonor.push.app_id" android:value="YOUR_HIHONOR_APP_ID" />
......
package io.flutter.plugins;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;
import io.flutter.embedding.engine.FlutterEngine;
/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
try {
flutterEngine.getPlugins().add(new com.aliyun.ams.push.AliyunPushPlugin());
} catch (Exception e) {
Log.e(TAG, "Error registering plugin aliyun_push, com.aliyun.ams.push.AliyunPushPlugin", e);
}
}
}
......@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
sdk.dir=/Users/shixiaochen/Library/Android/sdk
flutter.sdk=/Users/shixiaochen/work/flutter
\ No newline at end of file
......@@ -20,7 +20,7 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.2.0" apply false
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}
......
......@@ -9,13 +9,13 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
642B5777027559BFB3990CD0 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 54EB9D55DE140402316A4917 /* libPods-Runner.a */; };
7EEF43542E05507600C1BD0E /* sound.wav in Resources */ = {isa = PBXBuildFile; fileRef = 7EEF43532E05507600C1BD0E /* sound.wav */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
AF88179FF383D763DED09AEC /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 54EB9D55DE140402316A4917 /* libPods-Runner.a */; };
CB35EBD32988E90F002F0731 /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = CB35EBD22988E90F002F0731 /* NotificationService.m */; };
CB35EBD72988E90F002F0731 /* notiservice.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = CB35EBCF2988E90F002F0731 /* notiservice.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
CB35EBE12988E959002F0731 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB35EBB72988E8C5002F0731 /* UserNotifications.framework */; };
......@@ -109,7 +109,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AF88179FF383D763DED09AEC /* libPods-Runner.a in Frameworks */,
642B5777027559BFB3990CD0 /* libPods-Runner.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -560,7 +560,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemo;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
......@@ -689,7 +689,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemo;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
......@@ -713,7 +713,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemo;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
VERSIONING_SYSTEM = "apple-generic";
......@@ -747,7 +747,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemonotiservice;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver.notiservice;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
......@@ -782,7 +782,7 @@
);
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemonotiservice;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver.notiservice;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
......@@ -817,7 +817,7 @@
);
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemonotiservice;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver.notiservice;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
......@@ -853,7 +853,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemonoticontent;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver.noticontent;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
......@@ -888,7 +888,7 @@
);
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemonoticontent;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver.noticontent;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
......@@ -923,7 +923,7 @@
);
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.aliyunemaspocdemonoticontent;
PRODUCT_BUNDLE_IDENTIFIER = com.clx.carrierDriver.noticontent;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
......
......@@ -40,7 +40,7 @@ class _HomePageState extends BaseState<HomePage> {
void initState() {
super.initState();
if (Platform.isAndroid) {
_aliyunPush.createAndroidChannel('8.0up', '测试通道A', 3, '测试创建通知通道');
_aliyunPush.createAndroidChannel('carrier_driver', '测试通道A', 3, '测试创建通知通道');
}
_addPushCallback();
}
......@@ -102,11 +102,11 @@ class _HomePageState extends BaseState<HomePage> {
String appKey;
String appSecret;
if (Platform.isIOS) {
appKey = "填写自己iOS项目的appKey";
appSecret = "填写自己iOS项目的appSecret";
appKey = "334023188";
appSecret = "28fc49e991ca4657a37edf2af8cb1e45";
} else {
appKey = "填写自己Android项目的appKey";
appSecret = "填写自己Android项目的appSecret";
appKey = "334023170";
appSecret = "9f25fc284a4d4eff8b9064a91ec937e3";
}
_aliyunPush
......
......@@ -155,10 +155,10 @@ userInfo fetchCompletionHandler
- (void)handleiOS10Notification:(UNNotification *)notification isSendAck:(BOOL)isSendAck {
UNNotificationRequest *request = notification.request;
UNNotificationContent *content = request.content;
NSDictionary *userInfo = content.userInfo;
NSDictionary *extras = content.userInfo;
// 通知时间
NSDate *noticeDate = notification.date;
// 标题
......@@ -197,11 +197,12 @@ userInfo fetchCompletionHandler
if (request.identifier != nil) {
result[@"messageId"] = request.identifier;
}
// 通知打开回执上报
[CloudPushSDK sendNotificationAck:userInfo];
if (isSendAck) {
[self.channel invokeMethod:@"onNotification" arguments:userInfo];
[self.channel invokeMethod:@"onNotification" arguments:result];
} else {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.channel invokeMethod:@"onNotificationOpened" arguments:result];
});
}
}
......@@ -251,7 +252,7 @@ userInfo fetchCompletionHandler
if ([userAction isEqualToString:UNNotificationDefaultActionIdentifier]) {
// 处理通知
[self handleiOS10Notification:response.notification isSendAck:NO];
[self.channel invokeMethod:@"onNotificationOpened" arguments:response.notification.request.content.userInfo];
// [self.channel invokeMethod:@"onNotificationOpened" arguments:response.notification.request.content.userInfo];
}
// 通知dismiss,category创建时传入UNNotificationCategoryOptionCustomDismissAction才可以触发
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论