android-notifications

How To give notifications on android on specific time?

心不动则不痛 提交于 2019-11-28 04:23:47
I want to give notification to my app on a specific time. Say everyday i have to give notification on 7 AM even if the app is closed. How can i do this? Any tutorial? Please mention the link. Shia G first you need to use a broadcastreceiver. and because a broadcast receiver up only for a short time from the android developer blog.When handling a broadcast, the application is given a fixed set of time (currently 10 seconds) in which to do its work. If it doesn't complete in that time, the application is considered to be misbehaving, and its process immediately tossed into the background state

java.lang.NoSuchMethodError: android.app.Notification$Builder.addAction

六眼飞鱼酱① 提交于 2019-11-28 04:07:02
问题 I have developed an android application where i have used notification to be displayed when the application starts The application works perfect when i run the code on android emulator where as when i try to run the same on real device which has android version of 4.0.4 It throws me error in the logcat as 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

Listen to incoming Whatsapp messages/notifications

喜夏-厌秋 提交于 2019-11-28 03:50:30
I'm working on a notification based app, for which I need to listen to incoming notifications. I've been able to listen to incoming calls, SMS, mail etc. I have no clue how to listen for pings or messages from friends on Whatsapp via code. Can this actually be done? If so, how? Can Accessibility Service be used for this, using Package Name as "com.whatsapp"? I was able to do this using Accessibility Service . Using this, you can listen to all notification on the notification bar. I listened to application-specification by adding the package name to the Accessibility Service service info ,

Android - Clear task flag not working for PendingIntent

梦想与她 提交于 2019-11-28 02:42:26
问题 I have a task stack of A > B > C. I am currently on C, and then I press the home button. I get a notification with the intent to take me to Activity A. I press the notification, and I'm at A but if I press back, I go to C, then B, then A. I am setting up my PendingIntent like so. Anything clearly wrong with it? final Intent notificationIntent = new Intent(mContext, ActivityA.class); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent

How to add a button into notification?

浪尽此生 提交于 2019-11-28 02:12:28
问题 I do it like this: RemoteViews views = new RemoteViews(..); views.setOnClickPendingIntent(R.id.button1,pd); noti.contentviews = views; and then notify the notification. I can see the button in the notification, but the button can't be clicked. When i click the button,the whole notification clicked! How can i resolve this question? I found everywhere for this,but nothing useful found. someone said, some phones don't support the notification button, but samsung galaxy s, the musicplayer's

Call onMessage method when the app is in background in flutter

我怕爱的太早我们不能终老 提交于 2019-11-28 01:41:57
问题 I'm new in flutter and dart. I'm trying to connect my app with FCM. When app is in foreground I create flutterLocalNotificationsPlugin and everything works fine, but I don't how to handle onMessage method when my app is in background. Have somebody any idea how I can resolve it? FirebaseMessaging firebaseMessaging = new FirebaseMessaging(); FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin(); @override void initState() { super.initState();

Android show a notification not working

微笑、不失礼 提交于 2019-11-28 01:26:58
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 notification int NOTIFICATION_ID = 1; Intent notifyIntent = new Intent(this, MainActivity.class); notifyIntent

Default notification background color

非 Y 不嫁゛ 提交于 2019-11-28 01:18:04
问题 I have a custom notification that uses a LinearLayout that contains an ImageView and a TextView . Before Android 4.0 all I needed to do was swap out the text colors with the EventContent and EventContent.Title styles and all the colors looked great. But on Android 4.0 (Ice Cream Sandwich) my custom notification background color is a light gray, and to make matters worse it clashes horribly with the default text styles. This is strange to me, since all the other notifications have a dark-gray

Android FCM notification grouping

自闭症网瘾萝莉.ら 提交于 2019-11-28 00:33:24
I was trying to implement FCM notification for a chat app and I want to achieve "WhatsApp-like" notification where the notification will be grouped by conversation. Say when Alice replied to a conversation with Bob inside, Bob will receive a notification with the body "Alice: the content ". But if Alice quickly reply to the conversation again, Bob will get another new notification but I just want to append the new reply onto the prev notification instead. How can I achieve that? By grouping the notification, I'm presuming you mean stacking or bundling notifications . This is more on how you

android 4.3 Bluetooth ble don't called onCharacteristicRead()

流过昼夜 提交于 2019-11-28 00:26:06
I've set the notification into android, It is not calling to method onCharacteristicRead() ???? It does not enter into the function. Why it is happening so?? Any help is appreciated Request the solutions. This is my code: private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { if (newState == BluetoothProfile.STATE_CONNECTED) { Log.i(TAG, "Connected to GATT server."); // Attempts to discover services after successful connection. Log.i(TAG, "Attempting to start service