android-notifications

Show android notification action buttons expanded by default

穿精又带淫゛_ 提交于 2019-12-11 07:42:22
问题 Is there a way to show action buttons in notification expanded by default? I use ongoing notification to control traning process in my app. I want controling buttons such as "Stop" and "Pause" to be visible right after notification appeared in the notification area. 回答1: You can't expand notification. The only solution is, set Priority Max, then the top of the notification list where it would be expanded. And it depends on the device as well. mBuilder.setPriority(Notification.PRIORITY_HIGH)

Use alarmManager and service to get data from server repeatedly

喜你入骨 提交于 2019-12-11 07:37:36
问题 My question is I want to verify every two hour that there is new data in the database, for that I create this user interface : <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <EditText android:id="@+id/speedAlert" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:gravity="center" android:hint="km/h" android:inputType=

Not sure if service onDestroy is called from BroadcastReceiver

不想你离开。 提交于 2019-12-11 06:49:08
问题 I have a service which I start using Intent serviceIntent = new Intent(getActivity().getApplicationContext(), LocationService.class); getActivity().startService(serviceIntent); When app is going into background, not closed , just not in foreground: i.e. press home button, I do: Notification notification = mBuilder.build(); service.startForeground(NOTIFICATION, notification); To bring the service to the foreground and show ongoing notification. I have a BroadcastReceiver which is fired when

NotificationCompat v7 not working on Oreo and later OS version

只愿长相守 提交于 2019-12-11 06:47:44
问题 I am having troubles with NotificationCompat v7 on android 8,9 . whats the best way to show notification on all android version debug log android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=null pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE) MinSDK=18, TargetSDK=28, Android Gradle Plugin Version=3.4.1, gradle version=5.1.1

Always getting data null from notification intent android

扶醉桌前 提交于 2019-12-11 06:07:33
问题 Always getting bundle null.... This is my code; edt=(EditText)findViewById(R.id.edt); String msg=edt.getText().toString(); //create Intent Intent myIntent = new Intent(this, ScondActivity.class); myIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); //Here I pass Data; myIntent.putExtra("msg",msg); //Initialize PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT); //Initialize NotificationManager using

How to sort notification channels in system settings on android O

别等时光非礼了梦想. 提交于 2019-12-11 06:05:14
问题 I have preset order of notification channels, that can be change. How to change order of notification channels? I try to sort by channel_id and channel_name, but it is not work. 回答1: There was error in my solution. I try to add number of channel on start of channel id for sorting. So i had this: 56_server_channel_id 78_server_channel_id 155_server_channel_id 9998_default_app_channel_id 9999_default_app_channel_id But because of missing leading zeros, it sorted not as i expected. So, right

How to get music player information set in expanded notification bar

一曲冷凌霜 提交于 2019-12-11 06:01:24
问题 I want to read notifications and get to know if any media player is showing in notification when expended. I tried using NotificationManager and getActiveNotification api but got empty list. 来源: https://stackoverflow.com/questions/48734096/how-to-get-music-player-information-set-in-expanded-notification-bar

Push notification received while the app is in the foreground is different from push notification received when the app is in background

与世无争的帅哥 提交于 2019-12-11 05:57:11
问题 I have implemented FCM push notifications in an android app. While I am logged in to the app. I get the notification in the form that I am expecting as below. When the app is in background I receive the json response instead as below. Following is the code I have added in onMessageRecieved() NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setContentTitle("App") .setContentText(messageBody) .setAutoCancel(true) .setSound(defaultSoundUri) .setSmallIcon(R

How to access extra bundle sent along with Remote Input in Direct Reply notifications?

穿精又带淫゛_ 提交于 2019-12-11 05:24:01
问题 I am trying to make an app that makes a direct reply notification from one activity and sets the text entered by user in the notification to a TextView in another activity. However i have two textviews in my second activity . One for the text entered in remote Input in my notification and second for the extra text i want to send along in a bundle with remote Input from first activity. The problem is that the text entered in the Remote input gets set to the desired Text View but the extra text

Notification PendingIntent extras always empty

自古美人都是妖i 提交于 2019-12-11 05:13:12
问题 I read about this all day long with different kind of solutions but non worked so far. I have an upload service (IntentService) that sends updates to a ResultReceiver. The receiver creates and manages the Notification. After clicking on the notification (error or success) the MainActivity is loaded. But the bundle is always null. How can I change my code to access/get the bundle? This happens if I'am in another Activity, if the App is in background and if the app is stopped.