代码改变世界

使用信鸽推送时打开指定页面的同时获取相关参数

2015-07-31 19:47  咒语  阅读(2705)  评论(0编辑  收藏  举报
@Override
protected void onResume(){
    super.onResume();
    XGPushClickedResult click = XGPushManager.onActivityStarted(this);
    if(click!=null){
        String cusContent = click.getCustomContent();
        if(!Guard.isNullOrEmpty(cusContent)){
            Log.w(TAG,cusContent);
        }
    }
}

@Override
protected void onPause() {
    super.onPause();
    XGPushManager.onActivityStoped(this);
}

 

只要把这个加在Actvity页面就行了。没有那么复杂。很多方法都能在XGPushManager中找到。

在项目指定一个固定页面来处理所有的通知,通过约定的枚举自定义参数来由指定页面打开不同的页面。这样应该会方便些吧。正在实践中。。。