android-notifications

Change notification intent in Android

試著忘記壹切 提交于 2019-12-01 23:08:03
问题 I have a service that shows a notification that I wish that will be able to go to a specific activity of my app each time the user presses on it. Usually it would be the last one that the user has shown, but not always. If the activity was started before, it should return to it, and if not, it should open it inside of the app's task, adding it to the activities tasks. In addition, on some cases according to the service's logic, I wish to change the notification's intent so that it will target

Up Navigation not launching parent activity

冷暖自知 提交于 2019-12-01 21:57:25
I have two activities A and B where A is the parent of B. Now I show a notification that launches B. when I tap on the notification, B launches. Then I click on the up button. It works finr when activity A is in the backstack but otherwise the app Just closes and does not launch activity A. My Setup. I have declared A as Parent of B in Manifest with A in SingleTop launchMode <activity android:name=".A" android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="

Strange allow/deny question on Huawei 5.1 phone when showing notification

走远了吗. 提交于 2019-12-01 19:54:42
So it turns out that Huawei phones with 5.1 can't display MediaStyle notifications so while fixing that, I made a very simple notification test and I get a strange question asking Allow App Name to push messages to the notification panel . I don't use push in any way, in fact the screenshot below is for an app that all it does is show a sample notification, nothing else. How can I make it not show that? This is the code: Notification notification = new Notification.Builder(getApplicationContext()) .setSmallIcon(R.drawable.ic_launcher_background) .setContentTitle("Track title") .setContentText(

Android NotificationListenerService onNotificationPosted fire twice

无人久伴 提交于 2019-12-01 18:03:51
I listen for notifications like WhatsApp Messages. But every time a notification comes in the NotificationListenerService fire twice. Does anyone know this problem?? This is a snippet from the AndroidManifest.xml: <service android:name=".NotifyService" android:label="WhatsNotify" android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"> <intent-filter> <action android:name="android.service.notification.NotificationListenerService"></action> </intent-filter> </service> And inside the NotificationListenerService class: public class NotifyService extends

Intent with old extra in onCreate() for singleTask Activity

戏子无情 提交于 2019-12-01 17:58:42
For example I created project with 2 activities: FirstActivity with android:launchMode="singleTask" flag and SecondActivity. At first user starts FirstActivity and after this SecondActivity will start on button click. From SecondActivity we create status bar notification. Intent intent = new Intent(SecondActivity.this, FirstActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(FirstActivity.ARG, true); NotificationCompat.Builder builder = new NotificationCompat.Builder(SecondActivity.this); builder.setSmallIcon(R.drawable.ic_launcher) .setAutoCancel(true)

Notification action button does not fire pending intent

谁说我不能喝 提交于 2019-12-01 17:53:48
I try to send intent to BroadcastReceiver from notification action button my problem is that when I click the button the intent in not fired or not getting to the BroadcastReceiver. Here is my code: The notification: Intent accept = new Intent(this, ChallengesActionReceiver.class); accept.setAction("com.soinfit.utilities.CHALLENGE_CLICK"); accept.putExtra("reqId", extras.getString("reqId")); accept.putExtra("answer", "1"); PendingIntent acceptIntent = PendingIntent.getActivity(this, 1, accept, PendingIntent.FLAG_CANCEL_CURRENT); NotificationCompat.Builder mBuilder = new NotificationCompat

Android notification not showing more than 3 actions

左心房为你撑大大i 提交于 2019-12-01 17:22:51
问题 I want to display a notification with 5 actions, but it ony displays 3 of them. This is the code I'm using for displaying it Notification notification = new android.support.v7.app.NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("My notification") .setContentText("Hello World!") .addAction(new NotificationCompat.Action.Builder(R.drawable.action1, null, pendingIntent1).build()) .addAction(new NotificationCompat.Action.Builder(R.drawable.action2, null,

Notification from IntentService - NullPointerException while obtaining Context

☆樱花仙子☆ 提交于 2019-12-01 16:42:08
I am unable to generate the notification (in the notification area) from an IntentService . I get a NullPointerException while obtaining NotificationManager . The problem is with Context. 06-01 16:46:05.910: ERROR/AndroidRuntime(14745): Caused by: java.lang.NullPointerException 06-01 16:46:05.910: ERROR/AndroidRuntime(14745): at android.content.ContextWrapper.getSystemService(ContextWrapper.java:363) 06-01 16:46:05.910: ERROR/AndroidRuntime(14745): at com.Android.Main1.FileUploaderService.<init>(FileUploaderService.java:71) The line of code is: mNotificationManager = (NotificationManager)

How to know if Show Notification is disabled for my app? [duplicate]

橙三吉。 提交于 2019-12-01 16:39:54
This question already has an answer here: Android 4.1: How to check notifications are disabled for the application? 5 answers Is there any way to track whether the user has "Show notifications" disabled/unchecked in the Settings/App Info page of my app? josedlujan Simple: You cant. In Google I/O 2012 answered: https://www.youtube.com/watch?v=Yc8YrVc47TI&feature=player_detailpage#t=1682s update: you can check if the user can see the notification in the status bar i.e. able TO CHECK (in the code) IF THE NOTIFICATION IS VISIBLE TO THE USER where android version >= 4.3. http://developer.android

Android NotificationListenerService onNotificationPosted fire twice

六月ゝ 毕业季﹏ 提交于 2019-12-01 16:15:35
问题 I listen for notifications like WhatsApp Messages. But every time a notification comes in the NotificationListenerService fire twice. Does anyone know this problem?? This is a snippet from the AndroidManifest.xml: <service android:name=".NotifyService" android:label="WhatsNotify" android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"> <intent-filter> <action android:name="android.service.notification.NotificationListenerService"></action> </intent-filter> </service> And