android-notifications

Correct way to create Notification Channels from Android O Api

混江龙づ霸主 提交于 2019-12-06 20:29:13
问题 The notification channels which introduced from Android O (API 26) version.I read about it from the following links: Managing notification channels Google Sample for Creating Channel Questions: If I have multiple numbers of notification then Is it a good idea to create notification channels when the application starts and keep it at ApplicationScope ? public void addNotificationChannels(Context context) { List<NotificationChannel> channels = new ArrayList<>(); channels.add("channel_1");

Is there a way an app can check if it is allowed to access notifications?

末鹿安然 提交于 2019-12-06 17:54:38
问题 I want to implement an NotificationListenerService to get access to all notifications that are posted to the notification bar. I understand that I need to enable access to the Notifications in the Settings with this call: startActivity(new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS")); Is there a way to check if the user activated Notification access for my app? 回答1: I managed to find a slight hack to solve this. If you check the source of Settings.Secure , you will see

Does Android provide a callback when the clear button on notifications list is clicked

╄→尐↘猪︶ㄣ 提交于 2019-12-06 14:14:57
Does Android provide a callback when the clear button on the notification list is clicked ? My app needs to clear some data whenever the notification is clicked or cleared. On clicking I know what to do, but how do I handle the second case ? You can set a deleteIntent in the notification object. But haven't played with it yet. public PendingIntent deleteIntent Since: API Level 1 The intent to execute when the status entry is deleted by the user with the "Clear All Notifications" button. This probably shouldn't be launching an activity since several of those will be sent at the same time. 来源:

Possible to continuously update text in the notification area?

我的梦境 提交于 2019-12-06 10:48:57
问题 I would like a to place persistent text in the notification area that updates once every second. setTicker() in the NotificationCompat.Builder class will not work, because it hides everything else in the notification area. I am only looking to place text there that is a few characters long, taking up only a small piece of the notification area. One way I think this can be done is by calling setSmallIcon(), and somehow using this small icon area to display text. I took a screenshot of an app's

Pending Intent created in Native Extension works only from Notification but not within Service

点点圈 提交于 2019-12-06 10:38:06
I’m developing an Air mobile application for Android which uses Air Native Extensions (ANE). From the ANE I call a function that creates a Pending Intent which is passed to a Notification. Next, the native function starts a service and passes it the Pending Intent and the Notification. Here’s the code for that part: public class StartServiceFunction implements FREFunction { @Override public FREObject call(FREContext context, FREObject[] args) { Log.d("MyApplicationStartServiceFunction", "call(StartService)"); Context applicationContext = context.getActivity().getApplicationContext(); try {

Nearby Notifications not showing

百般思念 提交于 2019-12-06 10:23:30
问题 I've configured three types of beacons: Eddystone-UID Eddystone-UID with TLM iBeacon They are visible in Google Beacons Dashboard, I see these beacons in Beacon Toolkit App in "Registered" tab too. I've added two nearby notifications: Unfortunately, I did not receive any notification with this web page. I see my beacons in third party beacon scanner. When I've started Nearby attractions scan manually: it didn't show any beacon related web pages. However, when I turn on Eddystone-URL beacon I

Did I screw up my System_server service?

荒凉一梦 提交于 2019-12-06 09:49:48
My phone is producing a non-stop Log.d output. The following repeats over and over again about 1200 times per second . 04-25 15:58:04.883 1542-5012/? D/NetworkStatsCollection: getHistory:mUID 10266 isVideoCallUID: false PID 1542 is System_server which I've come to understand manages an array of Android services. In the app I'm developing, I use the Alarm Manager and Notification service as seen below. Is there anything I could have done to cause this service to react the way it is? public void scheduleNotification(Context context, long alarmTime, int notificationId, String setOrCancel) {

Notification without “heads up”

大城市里の小女人 提交于 2019-12-06 08:43:10
I am trying to create a notification that has a high priority (a chatting app) but my client requested that there will be no "heads up" view for it. I have tried creating an empty layout for a RemoteViews to set as the Notification.headsUpContentView but still nothing. Here is what I've tried: Intent target = new Intent(this, PushConsumedBroadcastReceiver.class); target.putExtra(PushConsumedBroadcastReceiver.PUSH_TYPE, PushConsumedBroadcastReceiver.PUSH_TYPE_REMINDER); PendingIntent pending = PendingIntent.getBroadcast(this, Constants.REQUEST_CODE_BASE, target, PendingIntent.FLAG_UPDATE

Android: AlarmManager used to call a Service to notify the user

≡放荡痞女 提交于 2019-12-06 08:36:28
Edit Adding this line in my manifest solved my problem (the Service is well created). <service android:name=".TimersService" > Post I'm currently trying to implement alarms to notify the user that a countdown has finished. I have a method createAlarm() that adds a new Alarm through an AlarmManager . This method is currently called inside a Fragment. It looks like this: private final void createAlarm(String name, long milliInFuture) { Intent myIntent = new Intent(getActivity().getApplication(), TimersService.class); AlarmManager alarmManager = (AlarmManager) getActivity() .getSystemService

Android - GCM push notification that sends user to Activity does not result in onCreate call

安稳与你 提交于 2019-12-06 05:08:53
I am able to create push notifications, and to send the user to whichever Activity I want, but I notice that whenever the user lands on that Activity, the onCreate function does not get called. Is that supposed to be the case? How do I set it so that the onCreate of the Activity is called? Here is my Activity: public class QuestionActivity extends BaseListActivity { @Override public void onCreate(Bundle savedInstanceState) and here is how the notification is generated: Intent notificationIntent = new Intent(context, MainActivity.class); if ( notification_type != null && notification_type