![]() tOnClickPendingIntent(R.id.Menus Icon Bar Menu Icon Accordion Tabs Vertical Tabs Tab Headers Full Page Tabs Hover Tabs Top Navigation Responsive Topnav Split Navigation Navbar with Icons Search Menu Search Bar Fixed Sidebar Side Navigation Responsive Sidebar Fullscreen Navigation Off-Canvas Menu Hover Sidenav Buttons Sidebar with Icons Horizontal Scroll Menu Vertical Menu Bottom Navigation Responsive Bottom Nav Bottom Border Nav Links Right Aligned Menu Links Centered Menu Link Equal Width Menu Links Fixed Menu Slide Down Bar on Scroll Hide Navbar on Scroll Shrink Navbar on Scroll Sticky Navbar Navbar on Image Hover Dropdowns Click Dropdowns Cascading Dropdown Dropdown in Topnav Dropdown in Sidenav Resp Navbar Dropdown Subnavigation Menu Dropup Mega Menu Mobile Menu Curtain Menu Collapsed Sidebar Collapsed Sidepanel Pagination Breadcrumbs Button Group Vertical Button Group Sticky Social Bar Pill Navigation Responsive Header RemoteViews view = new RemoteViews(getPackageName(), R.layout.notification_discoveryservice) PendingIntent pExitIntent = PendingIntent.getBroadcast(this, 1, exitIntent, 0) String ACTION_NOTIFICATION_EXITACTIVITY = "" ĮtAction(ACTION_NOTIFICATION_EXITACTIVITY) Notification with exit button if supported PendingIntent pOpenIntent = PendingIntent.getActivity(this, 0, openIntent, 0) Intent openIntent = new Intent(MainActivity.this, MainActivity.class) setContentText("Service running in the background") setSmallIcon(R.drawable.notification_icon).setContentTitle("My Title") NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(myService) ![]() You can find all te correct resources in the android-21/data/res folder of your sdk) // NOTE: while creating pendingIntent: requestcode must be different! (The example below is based on the Holo look and feel and would still need to updated for lollipop. ![]() Instead of adding an action, define your own notification layout and connect a pendingIntent to fire to that via RemoteView. Is there any way I can make my action usable from the lock screen? I know that MediaStyle notifications have clickable buttons, but it feels like a hack to use MediaStyle even though it's not about media. SetVisibility((int))īuilder.AddAction(_action_lock, GetString(_lock), PendingIntent.GetBroadcast(this, 0, new Intent(Intents.LockDatabase), PendingIntentFlags.UpdateCurrent)) This is the code I am using the creating the notification (using Xamarin's Mono for Android): NotificationCompat.Builder builder = (The action shows that a password database is unlocked and the action button will lock the database.) However, when I want to click the action button of the notification, I first have to unlock the device which should not be required. ![]() After considering the answers on Lollipop Notification setVisibility() Does Not Work?, the notification is now displayed as expected. In order to better support Android 5 notifications, I am now setting my app's notification visibilty to "public".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |