• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XGPushTextMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.tencent.android.tpush.XGPushTextMessage的典型用法代码示例。如果您正苦于以下问题:Java XGPushTextMessage类的具体用法?Java XGPushTextMessage怎么用?Java XGPushTextMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XGPushTextMessage类属于com.tencent.android.tpush包,在下文中一共展示了XGPushTextMessage类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onTextMessage

import com.tencent.android.tpush.XGPushTextMessage; //导入依赖的package包/类
@Override
public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) {
    Log.e("收到透传消息", xgPushTextMessage.getContent() + "------" + xgPushTextMessage.getCustomContent() + "---------" + xgPushTextMessage.getTitle());
    allMessageOrderListBean=gson.fromJson(xgPushTextMessage.getContent(),AllMessageOrderListBean.class);
    SharedPreferences sp=context.getSharedPreferences("data",Context.MODE_PRIVATE);
    SharedPreferences.Editor editor=sp.edit();
    editor.putString("orderId",allMessageOrderListBean.getOrdersId()+"");
    editor.putString("userId",allMessageOrderListBean.getUserId()+"");
    editor.commit();
    Intent resultIntent = new Intent(context, MainActivity.class);
    resultIntent.setAction("CLEAR_NOTI_ACTION");
    context.sendBroadcast(resultIntent);
    PendingIntent resultPendingIntent =
            PendingIntent.getActivity(context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(context)
                    .setContentTitle("你有1条消息")
                    .setSmallIcon(R.mipmap.ic_launcher)
                    .setContentIntent(resultPendingIntent)
                    .setDefaults(Notification.DEFAULT_ALL)
                    .setContentText(xgPushTextMessage.getContent().toString());
    NotificationManager mNotifyMgr = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
    mNotifyMgr.notify(1, mBuilder.build());
}
 
开发者ID:CKTim,项目名称:MyApplication,代码行数:25,代码来源:CustomPushReceiver.java


示例2: onTextMessage

import com.tencent.android.tpush.XGPushTextMessage; //导入依赖的package包/类
@Override
public void onTextMessage(Context context, XGPushTextMessage message) {
	// TODO Auto-generated method stub
	String text = "收到消息:" + message.toString();
	// 获取自定义key-value
	String customContent = message.getCustomContent();
	if (customContent != null && customContent.length() != 0) {
		try {
			JSONObject obj = new JSONObject(customContent);
			// key1为前台配置的key
			if (!obj.isNull("v5_client")) {
				String value = obj.getString("v5_client");
				Logger.d(LogTag, "get custom value:" + value);
			}
			// ...
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}
	// APP自主处理消息的过程...
	Log.d(LogTag, text);
	show(context, text);
}
 
开发者ID:V5KF,项目名称:V5KFClientSDK-Android,代码行数:24,代码来源:MessageReceiver.java


示例3: onTextMessage

import com.tencent.android.tpush.XGPushTextMessage; //导入依赖的package包/类
@Override
public void onTextMessage(Context context, XGPushTextMessage message) {
	Log.i(LogTag,"消息透传,,onTextMessage-----");
	Toast.makeText(context,"消息透传",Toast.LENGTH_SHORT).show();
	String text = "收到消息:title is " + message.getTitle()+",,content is "+message.getContent()+",,customContent is "+message.getCustomContent();
	Log.i(LogTag,text);
	// 获取自定义key-value
	String customContent = message.getCustomContent();
	if (customContent != null && customContent.length() != 0) {
		try {
			JSONObject obj = new JSONObject(customContent);
			// key1为前台配置的key
			if (!obj.isNull("repeat_login")) {
				String value = obj.getString("repeat_login");
				Log.d(LogTag, "get custom value:" + value);
			}
			// ...
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}else {
		Log.i(LogTag,"customContent = null || customContent.length() = 0");
	}
	// APP自主处理消息的过程...

}
 
开发者ID:bangqu,项目名称:eshow-android,代码行数:27,代码来源:MessageReceiver.java


示例4: onTextMessage

import com.tencent.android.tpush.XGPushTextMessage; //导入依赖的package包/类
@Override
public void onTextMessage(final Context arg0, final XGPushTextMessage arg1) {
	// TODO Auto-generated method stub
	
	ProcessTask task = new ProcessTask();
	task.context = arg0;
	task.setProcessCheckFinishedListener(new IProcessCheckFinishedListener() {
		
		@Override
		public void OnProcessCheckFinished(Boolean result) {
			// TODO Auto-generated method stub
			if (result){
				showNotification(arg0,arg1.getTitle(),arg1.getContent(),arg1.getCustomContent());
				return;
			}
			intent = new Intent();
			intent.putExtra(XgAlertActivity.TITLE, "新消息");
			intent.putExtra(XgAlertActivity.CONTENT, arg1.getContent());
			intent.putExtra(XgAlertActivity.CUSTOMCONTENT, arg1.getCustomContent());
			Message message = new Message();      
            message.what = 1001;   
            myHandler.sendMessage(message);		
		}
	});
	task.execute("");	
}
 
开发者ID:simplelifetian,项目名称:GomeOnline,代码行数:27,代码来源:MessageReceiver.java


示例5: onTextMessage

import com.tencent.android.tpush.XGPushTextMessage; //导入依赖的package包/类
public void onTextMessage(Context context, XGPushTextMessage message) {
	if (context == null || message == null) {
		return;
	}
	String text = "onTextMessage:" + message.toString();
	Map<String,Object> map = new HashMap<String,Object>();
	map.put("xtype", "message");
	map.put("title", message.getTitle());
	map.put("content", message.getContent());
	JSONObject msg = new JSONObject(map);
	JSONObject customObj;
	try {
		String content =message.getCustomContent();
		if(content!=null&&!content.trim().equals("")) {
			customObj = new JSONObject(message.getCustomContent());
			msg.putOpt("custom", customObj);
		}
	} catch (JSONException e) {
		Log.e(LogTag, "create json falied", e);
	}
	Log.d(LogTag, text);
	if(msgCallbackContext!=null) {
		PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, msg);
		pluginResult.setKeepCallback(true);
		msgCallbackContext.sendPluginResult(pluginResult);
	}
}
 
开发者ID:zhihuwang,项目名称:xinge-cordova,代码行数:28,代码来源:XGPushCordovaReceiver.java


示例6: onTextMessage

import com.tencent.android.tpush.XGPushTextMessage; //导入依赖的package包/类
@Override
public void onTextMessage(Context context, XGPushTextMessage message) {
    mDanmakuView = MainActivity.mDanmakuView;
    danmushow(message.getTitle().toString()+" : "+message.getContent().toString(),context);
}
 
开发者ID:xbw12138,项目名称:shadowsocks_android,代码行数:6,代码来源:MessageReceiver.java


示例7: onTextMessage

import com.tencent.android.tpush.XGPushTextMessage; //导入依赖的package包/类
@Override
public void onTextMessage(Context context, XGPushTextMessage xgPushTextMessage) {

}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:5,代码来源:XinGeReceiver.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseDir类代码示例发布时间:2022-05-22
下一篇:
Java SchedulerApplication类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap