本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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);
}
});
}
}
示例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();
}
}