[英]Android push notification with big data
我想在沒有Web服務的情況下將數據從一個設備推送到另一個設備,就像推送通知一樣。 我想推送與通知相比更大的數據,並且該數據可能是文本或Json。僅該數據應在具有通知的設備之間推送。 當用戶單擊通知數據從設備上顯示時,不想通過Web服務器單擊通知后獲取數據。是否有可能。我有2個模擬器。這是我的2個模擬器屏幕截圖。
我已經嘗試過,但是通知會發送自己的模擬器,例如模擬器上側的綠色android圖標,但是如何將通知發送給第二個模擬器。有人可以幫我嗎。謝謝高級。
這是我的活動代碼。
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);
}
});
我認為您想開發像airdroid這樣的應用程序
https://play.google.com/store/apps/details?id=com.sand.airdroid&hl=zh_CN
據我所知,它在一台電話中設置了小型http服務器。 並從另一台設備發送請求。 如你所願。 本示例可幫助您創建這種http服務器。 兩個設備必須在同一網絡中有一個限制。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.