taoweiji / mixpush Goto Github PK
View Code? Open in Web Editor NEWAndroid 混合推送SDK,快速集成6个厂商推送,共享系统推送通道,杀死也能收到推送,推送到达率90%以上
License: Apache License 2.0
Android 混合推送SDK,快速集成6个厂商推送,共享系统推送通道,杀死也能收到推送,推送到达率90%以上
License: Apache License 2.0
魅族17,Flyme8.2.0.0A 系统不能正常获取regI,查询官方文档,官方推荐使用 MzSystemUtils.isBrandMeizu(this) 来判断是否是魅族品牌,希望大佬更新发包啊,这样就又可以愉快的玩耍了
服务器怎么判断使用哪套推送?
如题.猜猜 JCenter已关闭
onNotificationMessageArrived()和onNotificationMessageClicked()总是不执行? 可能是什么原因呢?我查了半天也找不到可能性的原因?请给与支持一下,谢谢了!
MixPushClient.getInstance().setPushReceiver(new MyMixPushReceiver());
MixPushClient.getInstance().register(this);
public class MyMixPushReceiver extends MixPushReceiver {
public static final String TAG = "mix";
@OverRide
public void onRegisterSucceed(Context context, MixPushPlatform mixPushPlatform) {
// 这里需要实现上传regId和推送平台信息到服务端保存,
//也可以通过MixPushClient.getInstance().getRegisterId的方式实现
register2Backend(mixPushPlatform.getPlatformName().toUpperCase(),mixPushPlatform.getRegId());
}
@OverRide
public void onNotificationMessageClicked(Context context, MixPushMessage message) {
// TODO 通知栏消息点击触发,实现打开具体页面,打开浏览器等。
Log.d(TAG, "onNotificationMessageClicked: " + message);
WebViewActivity.startWebViewShowTitleBarWithFlags(context,"https://www.baidu.com");
}
/**
}
passThroughPlatform看起来似乎是String?
谢谢
目前国内有远程推送的, 除了魅族和小米外, 还有华为呢, 而苹果远程推送也是比较容易接入, 这一块目前是使用个推做的么?
如题,如果同时接入了个推和小米推送,ios端会不会收到两条重复的消息
RT
万分感谢啦
eg> 需要msgId进行进一步操作 譬如,统计上报之类的
您好,目前正在测试集成您的这套框架的2.06,采用官网的网页版和我自己的js服务端向单个regid发送消息的办法,目前在测试华为平台时有如下问题:
集成后,onRegisterSucceed()可获得正确的id, 可以收到推送的消息,
但是onNotificationMessageArrived 和 onNotificationMessageClicked两个方法没有反应,IDE也没有相应的日志。
先前在集成小米推送的时候,如果Payload为空,onNotificationMessageArrived正常,onNotificationMessageClicked无反应
但是目前我的测试,使用华为推送,无论Payload是否为空,onNotificationMessageArrived 和 onNotificationMessageClicked两个方法均没有反应
希望得到您的帮助
目前只有测试了华为荣耀20 android10
1、在不接入华为相关sdk的情况下,也无法成功注册小米推送sdk
提示如下:
register all mi
[Thread:13149] sdk_version = 3_7_6
[Thread:13149] get region from system, region = cn
[Thread:13149] get region from system, region = cn
[Thread:13149] loadClass fail hasContext= false, errMsg = miui.os.Build
[Thread:13149] Don't send message before initialization succeeded!
[Thread:13149] Don't send message before initialization succeeded!
2、在接入华为相关sdk的情况下,如果华为sdk注册失败,无法继续注册小米推送
3、貌似不可以指定支持哪些厂商推送。例如仅接入小米 或者其中的某几个
Error:Execution failed for task ':client-core:processDebugAndroidTestManifest'.
Manifest merger failed with multiple errors, see logs
建议提供一个设备ID server能通过这个ID去那个通道推送
仓库jar包下载不下来
全局查找似乎没找到使用的地方
p.s. 提个issue的原因:即使不修改,下一个使用者可能会更明确api用法(?)
项目集成了com.tencent.mm:AndResGuard,当用压缩打包方式的时候,打出来的包在华为手机上获取MixPush-getRegisterId->超时,hms get token failed com.huawei.hms.common.ApiException: 907122050: operation in MAIN thread prohibited https://developer.huawei.com/consumer/cn/doc/development/HMSCore-References-V5/error-code-0000001050255690-V5->com.huawei.hms.common.ApiException: 907122050: operation in MAIN thread prohibited
System.err: at com.mixpush.core.MixPushClient$1.run(MixPushClient.java:185)
按照华为文档上的error码处理方式都检查过了,appid什么的都是配置正确,
很奇怪,如果直接run项目的话,就能获取到华为手机的registerid,就能推送成功,所以怀疑是AndResGuard压缩打包的时候导致的获取失败,但是我暂时还没找到解决办法,只能先不用AndResGuard压缩打包,请问大家这个有好的解决方法吗
大佬,请问在收到消息时 并没有走 onNotificationMessageArrived 回调 (只有小米正常回调了) 是什么原因呢? APPID 什么的都没错,
你好,https://github.com/taoweiji/MixPush/blob/master/mixpush-core/src/main/java/com/mixpush/core/MixPushClient.java#L159 中的Thread似乎没有任何释放操作,似乎不太符合最佳实践……谢谢
p.s. 硬编码120s超时,似乎可以改成传参
毕竟现在华为手机的使用率也很高==然而华为自家的推送其实也是个垃圾==
README的
<dependency>
<groupId>com.mixpush</groupId>
<artifactId>mixpush-sender</artifactId>
<version>2.0.2</version>
<type>pom</type>
</dependency>
似乎只导入了依赖,但没有导入sender本身;去掉<type>
后正常:
<dependency>
<groupId>com.mixpush</groupId>
<artifactId>mixpush-sender</artifactId>
<version>2.0.2</version>
</dependency>
你好,我是个个人开发者,只能申请到小米、华为、魅族的推送权限,无法申请到 OPPO 和 VIVO 的,因为这两家需要企业开发者才能申请。所以当我尝试去掉 OPPO 和 VIVO 的依赖时,发现 MixPush 初始化的时候报错了,提示无法找到 OPPO 和 VIVO 的相关类,导致无法完成初始化,也就没法拿到 regId。若不去除 OPPO 和 VIVO 的依赖,则初始化时提示没有找到 OPPO 对应的 appId(因为我没有,我的机型是 OPPO)
所以请问可以实现我只开启小米、华为、魅族的厂商通道,而其他机型一律使用默认的小米 Push 来接收吗?
你好,
我想fork这个库,在本地开发加些功能,然后再merge回来。不知道有什么推荐的方式吗?
尝试了jitpack,这个项目因为有多个子目录好像不支持;尝试直接gradle导入(settings.gradle做include),好像和Flutter冲突了。
谢谢
华为,小米, oppo都没问题,VIVO点击通知栏没反应
看到有写支持FCM,但是在导入依赖那没看到 谷歌
之前集成后是正常的可以获取到platform信息的,今天运行项目突然发现这个回调得到的platform总是空,请问可能是什么问题导致的呢?谢谢!代码如下:
MixPushClient.getInstance().setPushReceiver(new MyPushReceiver());
MixPushClient.getInstance().register(this);
MixPushClient.getInstance().getRegisterId(this, new GetRegisterIdCallback() {
public void callback(MixPushPlatform platform) {
if (platform != null) {
Log.i("mixpush","platform: " + platform.getPlatformName() +" regId: " + platform.getRegId());
// TODO MyPushReceiver的回调中或者在这里 上报regId给服务端,调用我们自己提供的接口
} else {
Log.i("mixpush","platform: null");
}
}
});
老师你好!
按照demo以及注册了华为和小米开发者平台,华为推送测试ok,小米手机利用服务端推送则报错.
有效报错log:
[ messageId=Xcm60262621473762966Eb errorCode=21301 reason=Invalid application secret. trace_id=Xcm60262621473762966Eb ]
UnifiedPushMessage{title='这里是标题', content='这里是副标题', platform='null', payload='{"url":"http://www.baidu.com"}', passThrough=false}
No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at com.huawei.push.messaging.HuaweiMessageClientImpl.sendRequest(HuaweiMessageClientImpl.java:144)
at com.huawei.push.messaging.HuaweiMessageClientImpl.send(HuaweiMessageClientImpl.java:76)
at com.huawei.push.messaging.HuaweiMessaging.sendMessage(HuaweiMessaging.java:134)
at com.huawei.push.messaging.HuaweiMessaging.sendMessage(HuaweiMessaging.java:86)
at ....mix_push_source.provider.HuaweiPushProvider.sendMessageToSingle(HuaweiPushProvider.java:41)
具体情况网上很多描述,例如:https://open.oppomobile.com/bbs/forum.php?mod=viewthread&tid=1657
正在加这个feature,之后提PR
环境:
Meizu Pro5
Android 7.0
你好,我在使用推送时出现 “必须设置 setPushReceiver() 才能正常工作”。出现操作,App没有进程时(App杀死状态),收到的推送消息,这是点击推送消息正常是会回调 onNotificationMessageClicked 方法。但是现在点击推送时只有如下日志打印:
E/MixPush: onNotificationMessageClicked UnifiedPushMessage{title='推送', content='推送推送推送', platform='meizu', payload='{"url":"app://lineUpPlay"}', passThrough=false}
推测方法是在 DefaultMixPushReceiver->onNotificationMessageClicked()中。
我的项目初始化是在Appcalition中的onCreate()方法中。
荣耀的平板会被判定成小米,应该是走华为通道吧?
在Application初始化中,回调的MixPushPlatform 一直为空是怎么回事
MixPushClient.getInstance().getRegisterId(this, new GetRegisterIdCallback() {
public void callback(MixPushPlatform platform) {
Log.e("GetRegisterIdCallback", platform.toString());
}
});
你好,
请问onRegisterSucceed和getRegisterId的关系,如果在onRegisterSucceed中上传了regid,是否就可以无视getRegisterId(阅读README,我猜可能是?)
p.s. 用于正在开发的flutter库
谢谢
解决办法 MzSystemUtils.isMeizuAndFlyme() 换成MzSystemUtils.isMeizu(content)
我在Application文件中设置
MixPushClient.getInstance().register(this,"huawei");
但是在Receiver里的onRegisterSucceed中,getPlatformName仍然是mi
1:直接使用华为的推送,在杀死应用的情况下,可以拉起指定页面;集成MixPush,在杀死应用的情况下,在自定义的Receiver收不到华为点开通知的回调
As title, if I want to register one platform instead of all, how should I config this package.
文档(https://dev.mi.com/console/doc/detail?pId=41 )中提到,
注意:
因为推送服务XMPushService在AndroidManifest.xml中设置为运行在另外一个进程,这导致本Application会被实例化两次,所以我们需要让应用的主进程初始化。
在非MIUI平台下,如果targetSdkVersion>=23,需要动态申请电话和存储权限,请在申请权限后再调用注册接口,否则会注册失败。
相关示例代码
public class DemoApplication extends Application {
...
@Override
public void onCreate() {
super.onCreate();
//初始化push推送服务
if(shouldInit()) {
MiPushClient.registerPush(this, APP_ID, APP_KEY);
}
...
}
private boolean shouldInit() {
ActivityManager am = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE));
List<RunningAppProcessInfo> processInfos = am.getRunningAppProcesses();
String mainProcessName = getApplicationInfo().processName;
int myPid = Process.myPid();
for (RunningAppProcessInfo info : processInfos) {
if (info.pid == myPid && mainProcessName.equals(info.processName)) {
return true;
}
}
return false;
}
}
但读了一下MixPush源码,好像没有判断这个
谢谢
你好,我们的app,oppo推送后台表示不支持,也就是说我们无法用oppo推送的,请问这个情景我如何解决比较便捷呢?有办法直接把oppo去掉,用小米推送去掉去代替吗?谢谢!
com.mixpush.huawei.HmsMessageReceiveActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'
需要添加android:exported="true"
Attempt to invoke interface method 'void com.mixpush.core.MixPushPassThroughReceiver.onReceiveMessage
I may use it in a Flutter project, and I see "flutter version" being in you TODO list. Thus, I may create a PR if you want :)
铃声 震动 静音等设置
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.