当前位置: 首页>>代码示例>>Java>>正文


Java MiPushMessage.getContent方法代码示例

本文整理汇总了Java中com.xiaomi.mipush.sdk.MiPushMessage.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java MiPushMessage.getContent方法的具体用法?Java MiPushMessage.getContent怎么用?Java MiPushMessage.getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.xiaomi.mipush.sdk.MiPushMessage的用法示例。


在下文中一共展示了MiPushMessage.getContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceivePassThroughMessage

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
     * 接收服务器发送的透传消息
     *
     * @param context
     * @param message
     */
    @Override
    public void onReceivePassThroughMessage(Context context, MiPushMessage message) {
        mMessage = message.getContent();
        if (!TextUtils.isEmpty(message.getTopic())) {
            mTopic = message.getTopic();
        } else if (!TextUtils.isEmpty(message.getAlias())) {
            mAlias = message.getAlias();
        }
//        Log.d("TAG", "message:" + mMessage);
        intent = new Intent();
        chatHelper = new ChatMessageDataHelper(App.getAppContext());

        if (mMessage.indexOf("^") != -1 && mMessage.indexOf("@") != -1) {
            //user information
            userInformation(mMessage);
        } else if (mMessage.indexOf("&") != -1 && mMessage.indexOf("@") != -1) {
            addFriendInformation(mMessage);
        } else {
            chatInformation(mMessage);
        }
    }
 
开发者ID:idisfkj,项目名称:HightCopyWX,代码行数:28,代码来源:WXMessageReceiver.java

示例2: praseMiPushMessage

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
 * 解析小米推送接受的消息
 *
 * @param message
 * @return
 */
public static PushMessageBean praseMiPushMessage(MiPushMessage message) {

    try {

        PushMessageBean pushMessage = new PushMessageBean();
        JSONObject jsonObj = new JSONObject(message.getContent());
        pushMessage.setTitle(jsonObj.getString("title"));
        pushMessage.setMessage(jsonObj.getString("message"));
        pushMessage.setType(jsonObj.getString("type"));
        pushMessage.setUri(jsonObj.getString("uri"));
        pushMessage.setMessageId(message.getMessageId());
        return pushMessage;

    } catch (Exception e) {

        if (BuildConfig.DEBUG)
            LogMgr.e(getTag(), "praseMiPushMessage error: " + e.getMessage());
    }

    return null;
}
 
开发者ID:joy-inc,项目名称:joy-app,代码行数:28,代码来源:XiaomiUtil.java

示例3: onReceivePassThroughMessage

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
@Override
public void onReceivePassThroughMessage(Context context, MiPushMessage message) {
    if (MiPushManager.sMixMessageProvider == null) {
        return;
    }
    String content = message.getContent();
    MixPushMessage mixPushMessage = new MixPushMessage();
    mixPushMessage.setPlatform(MiPushManager.NAME);
    mixPushMessage.setContent(content);
    mixPushMessage.setTitle(message.getTitle());
    mixPushMessage.setDescription(message.getDescription());
    mixPushMessage.setAlias(message.getAlias());
    mixPushMessage.setPassThrough(message.getPassThrough());
    MiPushManager.sMixMessageProvider.onReceivePassThroughMessage(context, mixPushMessage);
}
 
开发者ID:joyrun,项目名称:MixPush,代码行数:16,代码来源:MiPushMessageReceiver.java

示例4: onNotificationMessageClicked

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
@Override
public void onNotificationMessageClicked(Context context, MiPushMessage message) {
    if (MiPushManager.sMixMessageProvider == null) {
        return;
    }
    String content = message.getContent();
    MixPushMessage mixPushMessage = new MixPushMessage();
    mixPushMessage.setPlatform(MiPushManager.NAME);
    mixPushMessage.setContent(content);
    mixPushMessage.setTitle(message.getTitle());
    mixPushMessage.setDescription(message.getDescription());
    mixPushMessage.setAlias(message.getAlias());
    mixPushMessage.setPassThrough(message.getPassThrough());
    MiPushManager.sMixMessageProvider.onNotificationMessageClicked(context, mixPushMessage);
}
 
开发者ID:joyrun,项目名称:MixPush,代码行数:16,代码来源:MiPushMessageReceiver.java

示例5: onNotificationMessageArrived

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
@Override
public void onNotificationMessageArrived(Context context, MiPushMessage message) {
    if (MiPushManager.sMixMessageProvider == null) {
        return;
    }
    String content = message.getContent();
    MixPushMessage mixPushMessage = new MixPushMessage();
    mixPushMessage.setPlatform(MiPushManager.NAME);
    mixPushMessage.setContent(content);
    mixPushMessage.setTitle(message.getTitle());
    mixPushMessage.setDescription(message.getDescription());
    mixPushMessage.setAlias(message.getAlias());
    mixPushMessage.setPassThrough(message.getPassThrough());
    MiPushManager.sMixMessageProvider.onNotificationMessageArrived(context, mixPushMessage);
}
 
开发者ID:joyrun,项目名称:MixPush,代码行数:16,代码来源:MiPushMessageReceiver.java

示例6: onReceivePassThroughMessage

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
@Override
public void onReceivePassThroughMessage(Context context, MiPushMessage message) {

    String remoteMessageOrign = message.toString();
 //   Log.d(MYTAG, remoteMessageOrign);

    try
    {
        JSONObject remoteMessage = new JSONObject(message.getContent());

        if(!remoteMessage.has("isAt")) remoteMessage.put("isAt","0");
        if(!remoteMessage.has("senderType")) remoteMessage.put("senderType","1");


        //SharedPreferences Settings =        context.getSharedPreferences(PREF, Context.MODE_PRIVATE);
        String tokenSender = mySettings.getString("push_type","GCM");
        if(tokenSender.equals("MiPush")) {
            Log.d(MYTAG, "小米推送:"+remoteMessageOrign);
            MessageUtil.MessageUtilDo(context,remoteMessage.getString("msgId"),remoteMessage.getString("type"),remoteMessage.getString("senderType"),remoteMessage.getString("title"),remoteMessage.getString("message"),remoteMessage.getString("isAt"));

        }

    }
    catch (JSONException e)
    {
        e.printStackTrace();
    }

}
 
开发者ID:heipidage,项目名称:GcmForMojo,代码行数:30,代码来源:MiPushReceiver.java

示例7: onNotificationMessageClicked

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
 * 接收服务器发来的通知栏消息
 * (用户点击通知栏触发)
 *
 * @param context
 * @param message
 */
@Override
public void onNotificationMessageClicked(Context context, MiPushMessage message) {
    mMessage = message.getContent();
    if (!TextUtils.isEmpty(message.getTopic())) {
        mTopic = message.getTopic();
    } else if (!TextUtils.isEmpty(message.getAlias())) {
        mAlias = message.getAlias();
    }
}
 
开发者ID:idisfkj,项目名称:HightCopyWX,代码行数:17,代码来源:WXMessageReceiver.java

示例8: onNotificationMessageArrived

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
     * 接收服务器发来的通知栏消息
     * (消息到达客户端时触发,并且可以接收应用在前台时不弹出通知的通知消息)
     *
     * @param context
     * @param message
     */
    @Override
    public void onNotificationMessageArrived(Context context, MiPushMessage message) {
        mMessage = message.getContent();
        if (!TextUtils.isEmpty(message.getTopic())) {
            mTopic = message.getTopic();
        } else if (!TextUtils.isEmpty(message.getAlias())) {
            mAlias = message.getAlias();
        }
//        Log.d("TAG", "message通知:" + mMessage);
//        Log.d("TAG", "Alias通知:" + mAlias);
    }
 
开发者ID:idisfkj,项目名称:HightCopyWX,代码行数:19,代码来源:WXMessageReceiver.java

示例9: onReceivePassThroughMessage

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
@Override
    public void onReceivePassThroughMessage(final Context context, MiPushMessage message) {
        mMessage = message.getContent();
        if (!TextUtils.isEmpty(message.getTopic())) {
            mTopic = message.getTopic();
        } else if (!TextUtils.isEmpty(message.getAlias())) {
            mAlias = message.getAlias();
        } else if (!TextUtils.isEmpty(message.getUserAccount())) {
            mUserAccount = message.getUserAccount();
        }
        if (mPushInterface != null) {
            final Message result = new Message();
            result.setMessageID(message.getMessageId());
            result.setTitle(message.getTitle());
            result.setMessage(message.getContent());
            result.setExtra(mMessage);
            result.setTarget(Target.MIUI);
            try {
//                result.setExtra(JsonUtils.setJson(message.getExtra()).toString());
                result.setExtra(message.getContent());
            } catch (Exception e) {
                L.i("onReceivePassThroughMessage: " + e.toString());
                result.setExtra("{}");
            }
            JHandler.handler().post(new Runnable() {
                @Override
                public void run() {
                    mPushInterface.onCustomMessage(context, result);
                }
            });
        }


    }
 
开发者ID:jiang111,项目名称:AndroidPush,代码行数:35,代码来源:MiuiReceiver.java

示例10: onNotificationMessageClicked

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
@Override
    public void onNotificationMessageClicked(final Context context, MiPushMessage message) {
        mMessage = message.getContent();
        if (!TextUtils.isEmpty(message.getTopic())) {
            mTopic = message.getTopic();
        } else if (!TextUtils.isEmpty(message.getAlias())) {
            mAlias = message.getAlias();
        } else if (!TextUtils.isEmpty(message.getUserAccount())) {
            mUserAccount = message.getUserAccount();
        }
        if (mPushInterface != null) {
            final Message result = new Message();
            result.setNotifyID(message.getNotifyId());
            result.setMessageID(message.getMessageId());
            result.setTitle(mTopic);
            result.setMessage(mMessage);
            result.setTarget(Target.MIUI);
            try {
                result.setExtra(JsonUtils.setJson(message.getExtra()).toString());
//                result.setExtra(message.getContent());
            } catch (Exception e) {
                Log.e(TAG, "onNotificationMessageClicked: " + e.toString());
                result.setExtra("{}");
            }
            JHandler.handler().post(new Runnable() {
                @Override
                public void run() {
                    mPushInterface.onMessageClicked(context, result);
                }
            });
        }
    }
 
开发者ID:jiang111,项目名称:AndroidPush,代码行数:33,代码来源:MiuiReceiver.java

示例11: onNotificationMessageArrived

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
@Override
    public void onNotificationMessageArrived(final Context context, MiPushMessage message) {
        mMessage = message.getContent();
        if (!TextUtils.isEmpty(message.getTopic())) {
            mTopic = message.getTopic();
        } else if (!TextUtils.isEmpty(message.getAlias())) {
            mAlias = message.getAlias();
        } else if (!TextUtils.isEmpty(message.getUserAccount())) {
            mUserAccount = message.getUserAccount();
        }
        if (mPushInterface != null) {
            final Message result = new Message();
            result.setTitle(message.getTitle());
            result.setMessageID(message.getMessageId());
            result.setNotifyID(message.getNotifyId());
            result.setMessage(message.getDescription());
            result.setTarget(Target.MIUI);
            try {
                result.setExtra(JsonUtils.setJson(message.getExtra()).toString());
//                result.setExtra(message.getContent());
            } catch (Exception e) {
                L.i("onReceivePassThroughMessage: " + e.toString());
                result.setExtra("{}");
            }
            JHandler.handler().post(new Runnable() {
                @Override
                public void run() {
                    mPushInterface.onMessage(context, result);
                }
            });
        }
    }
 
开发者ID:jiang111,项目名称:AndroidPush,代码行数:33,代码来源:MiuiReceiver.java

示例12: onReceivePassThroughMessage

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
 * 接收服务器推送的透传消息,消息封装在 MiPushMessage类中
 */
@Override
public void onReceivePassThroughMessage(final Context context, final MiPushMessage message) {
    mMessage = message.getContent();
    if (!TextUtils.isEmpty(message.getTopic())) {
        mTopic = message.getTopic();
    } else if (!TextUtils.isEmpty(message.getAlias())) {
        mAlias = message.getAlias();
    } else if (!TextUtils.isEmpty(message.getUserAccount())) {
        mUserAccount = message.getUserAccount();
    }
    Log.d(TAG, "onReceivePassThroughMessage: " + message.toString());

    if (mPushListener != null) {
        final PushMessage result = new PushMessage();
        result.setMessageID(message.getMessageId());
        result.setTitle(message.getTitle());
        result.setMessage(message.getContent());
        result.setExtra(message.getExtra());
        result.setTarget(PhoneTarget.MIUI);

        PushHandler.handler().post(new Runnable() {
            @Override
            public void run() {
                mPushListener.onCustomMessage(context, result);
            }
        });
    }

}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:33,代码来源:MiMessageReceiver.java

示例13: onNotificationMessageClicked

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
 * 接收服务器推送的通知消息,用户点击后触发
 */
@Override
public void onNotificationMessageClicked(final Context context, MiPushMessage message) {
    mMessage = message.getContent();
    if (!TextUtils.isEmpty(message.getTopic())) {
        mTopic = message.getTopic();
    } else if (!TextUtils.isEmpty(message.getAlias())) {
        mAlias = message.getAlias();
    } else if (!TextUtils.isEmpty(message.getUserAccount())) {
        mUserAccount = message.getUserAccount();
    }

    Log.d(TAG, "onNotificationMessageClicked: " + message.toString());


    if (mPushListener != null) {
        final PushMessage result = new PushMessage();
        result.setNotifyID(message.getNotifyId());
        result.setMessageID(message.getMessageId());
        result.setTitle(mTopic);
        result.setMessage(mMessage);
        result.setExtra(message.getExtra());
        result.setTarget(PhoneTarget.MIUI);

        PushHandler.handler().post(new Runnable() {
            @Override
            public void run() {
                mPushListener.onMessageClicked(context, result);
            }
        });
    }
}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:35,代码来源:MiMessageReceiver.java

示例14: onNotificationMessageArrived

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
 * 接收服务器推送的通知消息,消息到达客户端时触发,还可以接受应用在前台时不弹出通知的通知消息
 * 在MIUI上,只有应用处于启动状态,或者自启动白名单中,才可以通过此方法接受到该消息
 */
@Override
public void onNotificationMessageArrived(final Context context, MiPushMessage message) {
    mMessage = message.getContent();
    if (!TextUtils.isEmpty(message.getTopic())) {
        mTopic = message.getTopic();
    } else if (!TextUtils.isEmpty(message.getAlias())) {
        mAlias = message.getAlias();
    } else if (!TextUtils.isEmpty(message.getUserAccount())) {
        mUserAccount = message.getUserAccount();
    }

    Log.d(TAG, "onNotificationMessageArrived: " + message.toString());

    if (mPushListener != null) {
        final PushMessage result = new PushMessage();
        result.setTitle(message.getTitle());
        result.setMessageID(message.getMessageId());
        result.setNotifyID(message.getNotifyId());
        result.setMessage(message.getDescription());
        result.setExtra(message.getExtra());
        result.setTarget(PhoneTarget.MIUI);

        PushHandler.handler().post(new Runnable() {
            @Override
            public void run() {
                mPushListener.onMessage(context, result);
            }
        });
    }

}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:36,代码来源:MiMessageReceiver.java

示例15: onReceivePassThroughMessage

import com.xiaomi.mipush.sdk.MiPushMessage; //导入方法依赖的package包/类
/**
 * 用来接收服务器发送的透传消息
 *
 * @param context
 * @param message
 */
@Override
public void onReceivePassThroughMessage(Context context, MiPushMessage message) {

    Logger.w(TAG + "onReceivePassThroughMessage" + message.toString());
    mMessage = message.getContent();
    if (!TextUtils.isEmpty(message.getTopic())) {
        mTopic = message.getTopic();
    } else if (!TextUtils.isEmpty(message.getAlias())) {
        mAlias = message.getAlias();
    } else if (!TextUtils.isEmpty(message.getUserAccount())) {
        mUserAccount = message.getUserAccount();
    }
}
 
开发者ID:arieshao,项目名称:Integration,代码行数:20,代码来源:PushReceiver.java


注:本文中的com.xiaomi.mipush.sdk.MiPushMessage.getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。