android add dynamic set channel

master
huangminlinux 6 years ago
parent a88416d6fd
commit 0905fe9820

@ -99,7 +99,12 @@ public class JPushPlugin implements MethodCallHandler {
HashMap<String, Object> map = call.arguments(); HashMap<String, Object> map = call.arguments();
boolean debug = (boolean)map.get("debug"); boolean debug = (boolean)map.get("debug");
JPushInterface.setDebugMode(debug); JPushInterface.setDebugMode(debug);
JPushInterface.init(registrar.context()); // 初始化 JPush JPushInterface.init(registrar.context()); // 初始化 JPush
String channel = (String)map.get("channel");
JPushInterface.setChannel(registrar.context(), channel);
JPushPlugin.instance.dartIsReady = true; JPushPlugin.instance.dartIsReady = true;
// try to clean getRid cache // try to clean getRid cache

@ -36,7 +36,7 @@ final JPush jpush = new JPush();
appKey: "a1703c14b186a68a66ef86c1", appKey: "a1703c14b186a68a66ef86c1",
channel: "theChannel", channel: "theChannel",
production: false, production: false,
// debug: true, debug: true,
); );
jpush.applyPushAuthority(new NotificationSettingsIOS( jpush.applyPushAuthority(new NotificationSettingsIOS(
sound: false, sound: false,

@ -27,8 +27,8 @@ class JPush {
void setup({ void setup({
String appKey, String appKey,
String channel,
bool production, bool production,
String channel = '',
bool debug = false, bool debug = false,
}) { }) {
_channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production, 'debug': debug}); _channel.invokeMethod('setup', { 'appKey': appKey, 'channel': channel, 'production': production, 'debug': debug});

Loading…
Cancel
Save