android-notifications

How to create Multiple statusbar Notifications in android

爱⌒轻易说出口 提交于 2019-11-26 16:42:05
问题 I need to create multiple statusbar notifications. When i pull down the statusbar, multiple notification icons should be displayed as a list. Each notification icon should show separate data to display on next page.How could i do this? My code: public class SimpleNotification extends Activity { private NotificationManager mNotificationManager; private int SIMPLE_NOTFICATION_ID; String str="Hai"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle

How to set the app icon as the notification icon in the notification drawer

前提是你 提交于 2019-11-26 15:59:49
问题 As shown in the figure... I am getting my notification icon(on left to the red colour). But I need to display the app icon as shown by the black arrow public void notify(View view){ notification.setSmallIcon(R.drawable.ic_stat_name); notification.setTicker("Welcome to ****"); notification.setWhen(System.currentTimeMillis()); notification.setContentTitle("abcd"); notification.setContentText("abcd"); Intent intent = new Intent(this, home.class); PendingIntent pendingIntent = PendingIntent

Notifications in specific time every day android

六眼飞鱼酱① 提交于 2019-11-26 15:56:51
问题 I'd like to make an app that let the user decide what time everyday wants him to remind something with notification... I'd like to know how am i supposed to trigger a notification in secific time the user wants e.x 7:00am and make him tap on the notification and enter the application in specific activity. But when the user doesn't want to get any more notifications (with a button click) how am i cancel all the notifications...? I made something like Intent intent = new Intent(this, main.class

INSTALL_FAILED_DUPLICATE_PERMISSION… C2D_MESSAGE

雨燕双飞 提交于 2019-11-26 15:43:25
I am using Google notifications in my app, and until now I have done below in the manifest: <!-- GCM --> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- GCM requires a Google account. --> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Keeps the processor from sleeping when a message is received. --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <!-- This app has permission to register and receive data message. --> <!-- Creates a custom permission so only this app can receive its messages. NOTE: APP_PACKAGE.permission

Android show a notification not working

梦想的初衷 提交于 2019-11-26 14:48:07
问题 Currently I have a service that plays music. I want to show a notification when the service start to play music. This is what I do: public void setUpNotification() { /* * Set up the notification for the started service */ Notification.Builder notifyBuilder = new Notification.Builder(this); notifyBuilder.setTicker("ticker"); notifyBuilder.setOngoing(true); notifyBuilder.setContentTitle("title"); notifyBuilder.setContentInfo("content info"); // set up an Intent if the user clicks the

PendingIntent is not working on Android O

浪子不回头ぞ 提交于 2019-11-26 14:44:25
问题 I have download notification in my application. I've added "Cancel" button to NotificationCompat.Builder by calling addAction() method. But button not working on Android O device. When I press "Cancel" button nothing happens. But button working on Android < O. My Notification : NotificationCompat.Builder notification = new NotificationCompat.Builder(context, channelId) .setContentTitle(title) .setSmallIcon(R.drawable.network_download) .setContentText(contentText) .setOngoing(true)

Click on the Notification programmatically

試著忘記壹切 提交于 2019-11-26 14:39:50
问题 I trying click on the notification after receiving it. I'm able to drag the notification drawer using the Accessibility service. For clicking the notification I'm using accessibilityEvent.getSource() and accessibilityNodeInfo.performAction(AccessibilityNodeInfo.ACTION_CLICK); My code: public class MyAccessibilityService extends AccessibilityService { /** * On receiving the AccessibilityEvent performs the Actions * * @param event */ @Override public void onAccessibilityEvent(AccessibilityEvent

How to create a notification with NotificationCompat.Builder?

随声附和 提交于 2019-11-26 12:59:18
I need to create a simple notification which will be shown in notification bar along with the sound and icon if possible? I also need it to be compatitible with Android 2.2, so i found that NotificationCompat.Builder works with all APIs above 4. If there's a better solution, feel free to mention it. thaussma The NotificationCompat.Builder is the most easy way to create Notifications on all Android versions. You can even use features that are available with Android 4.1. If your app runs on devices with Android >=4.1 the new features will be used, if run on Android <4.1 the notification will be

NotificationCompat.Builder deprecated in Android O

拥有回忆 提交于 2019-11-26 12:53:50
After upgrading my project to Android O buildToolsVersion "26.0.1" Lint in Android Studio is showing a deprecated warning for the follow notification builder method: new NotificationCompat.Builder(context) The problem is: Android Developers update their Documentation describing NotificationChannel to support notifications in Android O, and provide us with a snippet, yet with the same deprecated warning: Notification notification = new Notification.Builder(MainActivity.this) .setContentTitle("New Message") .setContentText("You've received new messages.") .setSmallIcon(R.drawable.ic_notify

Android - use external profile image in notification bar like Facebook

▼魔方 西西 提交于 2019-11-26 12:44:18
问题 I know you can send info in the push notification parameters like message, title, image URL, etc. How does Facebook show your profile pic with your message in the notification area? I want to use an external image in the notification area, so when you pull it down you see the profile image with the message. Right now, mine just shows the default icon from the drawable folder. I figured this might be a common question but couldn\'t find anything. Any help would be nice. 回答1: This statement