मैं मैं कहाँ अधिसूचना का इस्तेमाल किया है प्रदर्शित करने के लिए एक Android आवेदन जब आवेदन
आवेदन सही काम करता है जब मैं पर कोड चलाने शुरू होता है विकसित किया है एंड्रॉयड एमुलेटर जहां के रूप में 4.0.4
के Android संस्करण है जब मैं वास्तविक उपकरण पर समान चलाने का प्रयास है जो यह मेरे त्रुटि logcat में के रूप में
05-13 19:06:45.824: E/AndroidRuntime(15402): FATAL EXCEPTION: main
05-13 19:06:45.824: E/AndroidRuntime(15402): java.lang.NoSuchMethodError: android.app.Notification$Builder.addAction
05-13 19:06:45.824: E/AndroidRuntime(15402): at com.example.gpstracker.MainActivity.onCreate(MainActivity.java:54)
05-13 19:06:45.824: E/AndroidRuntime(15402): at android.app.Activity.performCreate(Activity.java:4470)
05-13 19:06:45.824: E/AndroidRuntime(15402): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-13 19:06:45.824: E/AndroidRuntime(15402): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-13 19:06:45.824: E/AndroidRuntime(15402): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
कोड है जो मैं कोशिश की है है,
फेंकताNotification noti = new Notification.Builder(this)
.setContentTitle("Driver GPS Tracker Application")
.setContentText("9ciphers")
.setSmallIcon(R.drawable.ic_launcher).setContentIntent(in)
.addAction(R.drawable.ic_launcher, "Start", i)
.addAction(R.drawable.ic_launcher, "Stop", in)
.addAction(R.drawable.ic_launcher, "Exit", pIntent).build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// Hide the notification after its selected
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, noti);
Toast.makeText(getApplicationContext(), "Application Started", Toast.LENGTH_SHORT).show();
notifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
किसी को भी यहाँ मैं यहाँ कुछ आपकी मदद के लिए
धन्यवाद याद आ रही है इस को हल करने के मेरी मदद कर सकते
लेकिन अगर मैं 'अधिसूचना कॉम्पैक्ट.बिल्डर' का उपयोग करता हूं तो मुझे अधिसूचना पैनल पर विभिन्न कार्यों की आवश्यकता होती है, यह अधिसूचना पैनल – NetStarter
@ नेटस्टार्टर में कार्रवाई भाग नहीं जोड़ता है: "अधिसूचना पैनल पर किए जाने वाले विभिन्न कार्यों" को तब तक समर्थित नहीं किया गया था जब तक एंड्रॉइड 4.1। – CommonsWare
@ नेटस्टार्टर http://developer.android.com/reference/android/app/Notification.Builder.html। यदि आपका ऐप एपीआई स्तर 4 के रूप में पुराने एंड्रॉइड के संस्करणों का समर्थन करता है, तो आप इसके बजाय अधिसूचना कॉम्पैक्ट.बिल्डर का उपयोग कर सकते हैं, एंड्रॉइड सपोर्ट लाइब्रेरी – Raghunandan