2015-01-03 5 views
12

मैं वर्तमान में एक एप पर काम कर रहा हूं जो एक पहनने वाले डिवाइस पर दिखाया गया है। अधिसूचना में अधिसूचना कार्ड (.setContentAction (0)) पर एक क्रिया शामिल है।एंड्रॉइड पहनने के इरादे से कार्रवाई की पुष्टि लंबित

enter image description here

सब कुछ ठीक काम कर रहा सिवाय इसके कि यह हर किसी के कार्ड पर क्लिक करता है एक पुष्टिकरण संदेश से पता चलता है।

enter image description here

के बाद से कार्ड के रूप में जल्द ही कोई इस पर क्लिक करता के रूप में अद्यतन किया जाता है, यह आवश्यक नहीं है एक पुष्टिकरण को दिखाने के लिए है।

अगर पुष्टि को रोकने का कोई तरीका है तो मैं पहले से ही आधिकारिक दस्तावेज (https://developer.android.com/training/wearables/ui/confirm.html#show-confirmation) की जांच करता हूं, दुर्भाग्य से मुझे अब तक कोई समाधान नहीं मिला है।

संपादित 09.07.2015

NotificationCompat.Builder builder = new NotificationCompat.Builder(context) 
            .setGroup("GROUP") 
            .setGroupSummary(false) 
            .setAutoCancel(false) 
            .setPriority(Notification.PRIORITY_HIGH) 
            .setSmallIcon(R.drawable.ic_timer_white_48dp); 

ArrayList<NotificationCompat.Action> actions = new ArrayList<>(); 
NotificationCompat.Action control = new NotificationCompat.Action.Builder(icon, null, pendingTimeIntent).build(); 

actions.add(control); 

builder.extend(new NotificationCompat.WearableExtender().addActions(actions).setContentAction(0).setBackground(background)); 

NotificationManagerCompat notificationManager = 
      NotificationManagerCompat.from(context); 
notificationManager.notify(Constants.NOTIFICATION_ID_WEAR, builder.build()); 
+0

क्या आपको इसके लिए कोई समाधान मिला? – Debugger

+0

नहीं, यही कारण है कि मैंने एक उछाल शुरू किया। – Lukas

+0

क्या आपके पास एक स्टैंडअलोन पहनने योग्य एप्लिकेशन है? मैंने हाल ही में एक स्मार्टवॉच ऐप पर काम किया, और मुझे यह समस्या नहीं थी। क्या आप कुछ कोड पोस्ट कर सकते हैं? – Blackbelt

उत्तर

0

आप संशोधित की कोशिश कर सकते अपने निर्माता की तरह:

NotificationCompat.Builder builder = new NotificationCompat.Builder(context) 
            .setGroup("GROUP") 
            .setGroupSummary(false) 
            .setAutoCancel(false) 
            .setPriority(Notification.PRIORITY_HIGH) 
            .setShowWhen(true)                     
.setSmallIcon(R.drawable.ic_timer_white_48dp); 

नोट पंक्ति:

.setShowWhen(true); 

और तुम आशय का झंडा संशोधित कर सकते हैं झूठी:

Intent intent = new Intent(this, ConfirmationActivity.class); 
intent.putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, 
       ConfirmationActivity.SUCCESS_ANIMATION); 
intent.putExtra(ConfirmationActivity.EXTRA_MESSAGE, 
       getString(R.string.msg_sent)); 
intent.putExtra(ConfirmationActivity.EXTRA_SHOW_WHEN, false); 
startActivity(intent); 

मुझे नहीं पता कि यह ठीक से काम करता है, लेकिन मुझे उम्मीद है कि यह आपको एक सुराग देता है।

+1

यह काम नहीं कर रहा है, क्योंकि अधिसूचना कॉम्पेट .earableExtender()। AddActions (कार्रवाइयां) केवल नोटिफिकेशन कॉम्पेट.एक्शन के प्रकार लेता है, जो सिर्फ एक लंबित के साथ काम करता है। लंबित इरादे में अतिरिक्त जोड़ना संभव नहीं है। – Lukas

+0

यह काम नहीं करता है, चूंकि wearextender अधिसूचना कार्रवाई लंबित अनुलग्नक कार्रवाई पुष्टिकरण गतिविधि मंशा नहीं है, क्योंकि यह अधिसूचना फ़ोन ऐप से ट्रिगर की गई है, न कि पहनने वाले ऐप से – Libin

संबंधित मुद्दे