android-notifications

How to use Scheduler for Http Request

爱⌒轻易说出口 提交于 2019-12-11 04:54:15
问题 I want to create a application in Android that once it is installed in the deive.It send a HTTP rrequest in every 5 mins .After getting the response it shows the notification .How could i do this . Activity Code public class AutoNotification extends Activity { String url=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_auto_notification); postHttpRequest("Test","Test"); } public void postHttpRequest(String

Reuse current app instance when clicking on Notification [duplicate]

余生长醉 提交于 2019-12-11 04:22:18
问题 This question already has answers here : Resume application and stack from notification (7 answers) Closed 2 years ago . Right now I'm using a PendingIntent to launch my desired Activity from the Notification . But I want to know if it's possible to reuse the current app instance. For example: Launch app, the Launcher Activity is called HomeActivity Navigate to SecondActivity Press the home button Click on the notification from the app and resume SecondActivity But if the user didn't navigate

Does NotificationManagerCompat only have wear-specific features in relation to NotificationManager?

大城市里の小女人 提交于 2019-12-11 04:12:03
问题 The Android tutorials say to use NotificationManagerCompat class to show notifications, but since this class has no createNotificationChannels method, it's a bit awkward to handle 2 different NotificationManager s. From my search online it seems that all internal features of NotificationManagerCompat are specific to Android Wear and have no effect on phone/tablet. Is that observation correct? 回答1: As stated the NotificationManagerCompat is a "Compatibility library for NotificationManager with

Exact time for custom notifications in Android

故事扮演 提交于 2019-12-11 04:03:37
问题 I am developing an Android application for counseling services. Client can view their scheduled appointment in app. For example, Next appointment: Dec 31 2016 10:00AM Now I need to do that user will receive 2 notifications – reminders about appointment. One on 7 days before and another on 3 days before. I save this date (Dec 31 2016 10:00AM) as a String so I can extract year, month, etc. I found that I need to write some kind of service which will send these notifications. This is what I

How to set notification to clear itself on click?

北城以北 提交于 2019-12-11 03:53:41
问题 How to set my notification to clear itself on click? I've set autoCancel(true) but it doesn't work My code: Notification n = new Notification.Builder(this) .setContentTitle("Update for you") .setContentText("Please click here to see the update information") .setLargeIcon(BitmapFactory.decodeResource(this.getResources(), R.drawable.ic_launcher)) .setSmallIcon(R.drawable.ic_launcher) .setContentIntent(pList) .setAutoCancel(true) .addAction(R.drawable.ic_read, "Read", pRead) .addAction(R

Android, Custom Notification, Giving me always white Text

折月煮酒 提交于 2019-12-11 03:26:45
问题 I am trying to make a custom notification bar, it works and all but when i test it in lollipop it's displaying the title and content text with white color text, it is good for kitkat because the notification bar is dark but not for lollipop. How can i make it change to default color or at least detect the theme of the action bar so i can make an if statement to change the color of the text. <LinearLayout android:id="@+id/right" android:layout_width="fill_parent" android:layout_height="wrap

Android RemoteServiceException: Bad notification posted from package Couldn't cache contentViews

那年仲夏 提交于 2019-12-11 02:55:40
问题 I have an Android app that is crashing due to an unhandled exeption, but only on one particular device (running Nougat). I believe they are the only one of my testers that is running Nougat. This is the exception: Java.Lang.RuntimeException: Bad notification posted from package [my package name]: Couldn't cache contentViews: package=[my package name] Here is the stack trace: android.app.RemoteServiceException: Bad notification posted from package com.elephanigma.starmygrooves: Couldn't cache

How to Start one Activity and two service on notification click

人走茶凉 提交于 2019-12-11 02:29:08
问题 When user click on notification I want to start an Activity and two Intent Service. Is it possible to do ? If yes Please can any one give me the idea to do this ? Suppose I have no control on Activity. The Activity belongs to third party app. Please don't tell me that start intent service from your Activity . I know this. 回答1: Follow the steps Hope this helps you 1) Create a BroadCastReceiver public class MyBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context

Android: I need to delay a Notification

假装没事ソ 提交于 2019-12-11 02:10:00
问题 I've create a broadcast receiver that listen to the android.provider.Telephony.SMS_RECEIVED event and creates its own notification. I also use the same receiver in the app to update the activities when an sms is received using a callback. The problem is that the sms app notification event is dispatched after my notification, so when I update the sms is not preset in content://sms I would like to delay my notification if it's possible, can't find how to do it. here's the code: public class

Remove ongoing notification from service

守給你的承諾、 提交于 2019-12-11 01:53:31
问题 I have a service that create a notification when it is started. And then ondestroy() i want it to be removed. I just use .cancel(NOTIFICATION_ID); It works great when it is a normal notification but when i am using ongoing event it just won't cancel it. I did read something about that services doesn't stop if android have the resources for it, but how to overcome this? I use this code to start the service final Intent bg_service = new Intent(BackgroundService.class.getName()); btn_start =