简体   繁体   English

Android大数据推送通知

[英]Android push notification with big data

I want to push data from device to device without web service, As like push notification. 我想在没有Web服务的情况下将数据从一个设备推送到另一个设备,就像推送通知一样。 I want to push data which are more in size as compare to the notification and the data may be text or Json.Only that data should push from device to device with notification. 我想推送与通知相比更大的数据,并且该数据可能是文本或Json。仅该数据应在具有通知的设备之间推送。 When user click on the notification data gets display from device, don't want to fetch data after click on the notification with web server.Is it possible for this.I have 2 emulator.Here is my 2 Emulator Screen shot. 当用户单击通知数据从设备上显示时,不想通过Web服务器单击通知后获取数据。是否有可能。我有2个模拟器。这是我的2个模拟器屏幕截图。

在此处输入图片说明

I have tried but the notification send my own emulator like green colour android icon on upper side on emulator, but how to send notification to second emulator.Can someone help me please.Thanks in advanced. 我已经尝试过,但是通知会发送自己的模拟器,例如模拟器上侧的绿色android图标,但是如何将通知发送给第二个模拟器。有人可以帮我吗。谢谢高级。

Here is my Activity code. 这是我的活动代码。

btnSubmitRequirment = (Button)findViewById(R.id.buttonSubmit_Order);
        btnSubmitRequirment.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                String sms = "abcdefghijklmnopqrstuvwxyz this is SMS !!!!";
                String phoneNo="15555215556";
                SmsManager smsManager = SmsManager.getDefault();
                smsManager.sendTextMessage(phoneNo, null, sms, null, null);
                Toast.makeText(getApplicationContext(), "SMS Sent!",
                            Toast.LENGTH_LONG).show();



                NotificationManager notifManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
                long when = (long) 04.15;
                Notification notif = new Notification(R.drawable.ic_launcher, sms, when );

                Intent notifIntent = new Intent(context, Activity.class);

                notifIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

                PendingIntent intent = PendingIntent.getActivity(context, 0, notifIntent, 0);

                notif.setLatestEventInfo(context, "Order", sms, intent);
                notif.flags |= Notification.FLAG_AUTO_CANCEL;
                notifManager.notify(0, notif);
            }
        });

I think you want to develop a application like airdroid 我认为您想开发像airdroid这样的应用程序

https://play.google.com/store/apps/details?id=com.sand.airdroid&hl=en https://play.google.com/store/apps/details?id=com.sand.airdroid&hl=zh_CN

As i know it set up small http server in one phone. 据我所知,它在一台电话中设置了小型http服务器。 And Send request from an another device. 并从另一台设备发送请求。 As you want. 如你所愿。 This sample help you to create such kind of http server. 本示例可帮助您创建这种http服务器。 There is one restriction both device must be in same network. 两个设备必须在同一网络中有一个限制。

https://github.com/NanoHttpd/nanohttpd . https://github.com/NanoHttpd/nanohttpd

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM