绑定
bindAliasAndTag(alias, tags) { var isAndorid, PushManager, context, Instance, GeTuiSdk; if (plus.os.name == 'Android') { isAndorid = true; } else { isAndorid = false; } if (isAndorid) { PushManager = plus.android.importClass("com.igexin.sdk.PushManager"); context = plus.android.runtimeMainActivity().getContext(); Instance = PushManager.getInstance(); } else { GeTuiSdk = plus.ios.importClass("GeTuiSdk"); } if (isAndorid) { console.log('获取到cid==', Instance.getClientid(context)); console.log('获取到版本号==', Instance.getVersion(context)); console.log('获取到tags==', JSON.stringify(tags)); console.log('获取到alias==', alias); //绑定别名 Instance.bindAlias(context, alias); //绑定标签 var Tag = plus.android.importClass("com.igexin.sdk.Tag"); var tagParam = new Array(); for (let i = 0; i < tags.length; i++) { var tag = new Tag(); tag.setName(tags[i]); tagParam[i] = tag; console.log('tags[' + i + ']==', tags[i]); } console.log('tagParam==', JSON.stringify(tagParam)); Instance.setTag(context, tagParam, Date.now() + ""); } else { GeTuiSdk.bindAliasandSequenceNum(alias, alias); GeTuiSdk.setTags(tags); } }
解绑
unbind(alias) { if (isAndorid) { Instance.unBindAlias(context, alias, true); } else { GeTuiSdk.unbindAliasandSequenceNumandIsSelf(alias, alias, true); } }