Skip to content

Commit 0905fe9

Browse files
committed
android add dynamic set channel
1 parent a88416d commit 0905fe9

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

android/src/main/java/com/jiguang/jpush/JPushPlugin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ public void setup(MethodCall call, Result result) {
9999
HashMap<String, Object> map = call.arguments();
100100
boolean debug = (boolean)map.get("debug");
101101
JPushInterface.setDebugMode(debug);
102+
102103
JPushInterface.init(registrar.context()); // 初始化 JPush
104+
105+
String channel = (String)map.get("channel");
106+
JPushInterface.setChannel(registrar.context(), channel);
107+
103108
JPushPlugin.instance.dartIsReady = true;
104109

105110
// try to clean getRid cache

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final JPush jpush = new JPush();
3636
appKey: "a1703c14b186a68a66ef86c1",
3737
channel: "theChannel",
3838
production: false,
39-
// debug: true,
39+
debug: true,
4040
);
4141
jpush.applyPushAuthority(new NotificationSettingsIOS(
4242
sound: false,

lib/jpush_flutter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class JPush {
2727

2828
void setup({
2929
String appKey,
30-
String channel,
3130
bool production,
31+
String channel = '',
3232
bool debug = false,
3333
}) {
3434
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production, 'debug': debug});

0 commit comments

Comments
 (0)