简体   繁体   中英

Android push notification with big data

I want to push data from device to device without web service, As like push notification. 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. 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.

在此处输入图片说明

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.

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

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

As i know it set up small http server in one phone. And Send request from an another device. As you want. This sample help you to create such kind of http server. There is one restriction both device must be in same network.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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