android-notifications

Android: Presenting a notification during a call?

╄→гoц情女王★ 提交于 2019-11-26 21:08:14
问题 I have a broadcast receiver that listens to incoming calls. And I want to tweak the incoming call screen. Right now I can present toasts and add notifications to the notification bar (BTW the user can't pull it down because the screen is locked, before accepting the call, which kinda sucks). I tried to show an alert but it crashed - is it not allowed? Is there a way for the code in the broadcast receiver to do other things, like change the avatar of the caller or give it a name (even if it

Cancel notification on remove application from multitask panel

半城伤御伤魂 提交于 2019-11-26 20:00:01
I manage an ONGOING notification from my application (not from a service). When I kill application from task manager with "End" button, notification disappear . When I remove application from multitask pannel, application is killed but notification remains . My questions are: How to catch this event to clear notification? What happens when application is removed from multitask pannel? Application is destroyed but process staying alive? Is it normal? As an update: All my activities extends MyActivity class (which extends Activity) with methods: @Override protected void onCreate(Bundle state) {

Is possible set Expanded Notification as default in Big Text Notifications?

浪子不回头ぞ 提交于 2019-11-26 19:56:59
问题 I followed this Sample Code In Big Text Notifications section, he said that need expand to see Big text notification form, as image im below : I wonder that we can not set Expanded Notification as default in Big Text Notifications? People who know it is can or not, If can, Please tell me how to do it, Thanks, 回答1: The documentation states: A notification's big view appears only when the notification is expanded, which happens when the notification is at the top of the notification drawer, or

How to dismiss notification after action has been clicked

眉间皱痕 提交于 2019-11-26 19:40:19
Since API level 16 (Jelly Bean), there is the possibility to add actions to a notification with builder.addAction(iconId, title, intent); But when I add an action to a notification and the action is pressed, the notification is not going to be dismissed. When the notification itself is being clicked, it can be dismissed with notification.flags = Notification.FLAG_AUTO_CANCEL; or builder.setAutoCancel(true); But obviously, this has nothing to with the actions associated to the notification. Any hints? Or is this not part of the API yet? I did not find anything. When you called notify on the

Android: Test Push Notification online (Google Cloud Messaging) [closed]

旧街凉风 提交于 2019-11-26 19:18:31
Update: GCM is deprecated, use FCM I am implementing Google Cloud Messaging in my application. Server code is not ready yet and in my environment due to some firewall restrictions I can not deploy a test sever for push notification. What I am looking for is a online server which would send some test notifications to my device to test my client implementation. Found a very easy way to do this. Open http://phpfiddle.org/ Paste following php script in box. In php script set API_ACCESS_KEY, set device ids separated by coma. Press F9 or click Run. Have fun ;) <?php // API access key from Google API

Changing LED color for notifications

萝らか妹 提交于 2019-11-26 19:15:03
问题 I am basically just experimenting with Android development, and a couple of days ago I came across this app called "Go SMS Pro", which, among other things, can set up notifications in different colors (blue, green, orange, pink and light blue). So, I have tried to do this myself in my own app, however I cannot change neiher the color nor the blinking internal of the LED. I currently use this code: public class MainActivity extends Activity { static final int NOTIFICATION_ID = 1; @Override

Set notification to specific time

我只是一个虾纸丫 提交于 2019-11-26 19:06:47
问题 I would like my notification to run at 12:00pm everyday. How do you replace the when value with a time? NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Notification notify = new Notification(R.drawable.icon,"Its Time to Eat",when); Context context = GrubNOWActivity.this; CharSequence title = "Its Time to Eat"; CharSequence details = "Click Here to Search for Restaurants"; Intent intent = new Intent(context,Search.class); PendingIntent pending =

How to Schedule Notification in Android

…衆ロ難τιáo~ 提交于 2019-11-26 18:54:13
问题 I'm trying to set notification for a time in the future. I have the code for creating a notification but I can't find an option to schedule it. How can I schedule notifications? 回答1: You need to use PendingIntent and BroadCastReceiver for this - public void scheduleNotification(Context context, long delay, int notificationId) {//delay is after how much time(in millis) from current time you want to schedule the notification NotificationCompat.Builder builder = new NotificationCompat.Builder

How to update Notification with RemoteViews?

佐手、 提交于 2019-11-26 17:31:48
问题 I'm creating a notification with RemoteViews from a custom Service , which is running with notification in a foreground mode (that is, service will remain active as long as notification is visible to user). Notification is set as Ongoing so user cannot swipe it off. I'd like to change for example bitmap shown in ImageView , contained within remote view's layout or change text value in a TextView . Layout in remote view is set with XML layout file. My problem is that once notification is

NotificationListenerService Implementation

可紊 提交于 2019-11-26 17:31:40
问题 I am trying to implement NotificationListnerService which is added in android 4.3 but I am not able to get the notification details. My code are as below public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this); mBuilder.setSmallIcon(R.drawable.ic_launcher); mBuilder.setContentTitle(