android-notifications

Why notifications are getting fired multiple times on retrieving data from Firebase?

倾然丶 夕夏残阳落幕 提交于 2019-12-12 03:47:13
问题 I have a button, when I press it some data is fetched from FirebaseDatabase and then a notification is fired. Here's how: aReference.child(rID).addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { if (dataSnapshot.getValue() != null) { Map<String, String> newRequest = (Map<String, String>) dataSnapshot.getValue(); uAU = newRequest.get("pName"); final int m = (int) ((new Date().getTime() / 1000L) % Integer.MAX_VALUE); Intent

Can not create Alarm Manager

半世苍凉 提交于 2019-12-12 03:38:51
问题 Sorry for my bad English. I faced with the problem. I try to create persistent alarm notification. Alarm notification must start every 10 seconds. I am using Alarm Manager,but it doest't work. What i am doing wrong? public class RemindReceiver extends BroadcastReceiver { private Class<?> activityClass; public RemindReceiver() { } public RemindReceiver(Class<?> activityClass) { this.activityClass = activityClass; } @Override public void onReceive(Context context, Intent intent) {

Cannot access notification through Android AccessibilityService

非 Y 不嫁゛ 提交于 2019-12-12 03:34:11
问题 I am trying to access the notifications on my android phone using the AccessibilityService. I tried making a service and calling it from the main activity. I've also added meta for the service. It's not working. I cannot see the triggering of the service. I'm using Android L for testing. In accessibility settings I've added my app 'Notify' as on. Thanks in advance. My main Activity package com.example.tony.notify; import android.content.Intent; import android.provider.Settings; import android

Not able to identify id for item clicked on notification

十年热恋 提交于 2019-12-12 02:51:52
问题 I have multiple notifications, when I click on a single notification I need pass its invoice id which I'm getting from a webservice to other Activity and display its details. The issue I'm facing is that the below code is giving me same invoice id for all notifications, I know something is wrong, but I wasn't able to figure out. Please point out my mistake. public class SampleSchedulingService extends IntentService { public SampleSchedulingService() { super("SchedulingService"); } List

Not Opening the New Activity After Clicking on the Notification Android

做~自己de王妃 提交于 2019-12-12 02:19:18
问题 Here i want to open a new activity class called View. Once after click on the generated notification. How can i do that?? Some immediate reply will be appreciated. It worked well earlier(before add switch statements with calendar) Now i`m getting the notification. but not opening the new activity after clicking on the notification public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.v("Message", "Alarm"); String lang = ""

Android BLE scan interval for Nearby Notifications?

北城余情 提交于 2019-12-12 02:14:14
问题 What is the scan interval that is currently being used by Android for the Nearby Notifications feature (app-less)? On a parallel note, does the stability value for the beacon have anything to do with this interval? How/If is the Nearby Notification affected when the stability value is changed between stable, portable, mobile & roving? 回答1: Nearby Notifications scanning is also the same as Nearby Messages background scanning. It does so at every screen on. The stability of the beacon does not

Google Cloud Message - Notification USB Behavior

家住魔仙堡 提交于 2019-12-12 02:13:11
问题 Sorry, my english is not so good... anyway. I have a android application that uses GCM to receive push notifications. Steps: 1 - User click logon button 2 - Android app save the registration ID ( Working ) 3 - Send to WebService and put in database ( Working) 4 - Server Application (C#) send the message for selected registration id ( Working) 5 - Device receive the notification normally, BUT just if device is CONNECTED ON USB ( * PROBLEM * ) if i dont connect the device on usb, i receive the

Why can't we call StopForeground() method in the broadcast receiver class?

ぐ巨炮叔叔 提交于 2019-12-12 02:09:21
问题 I have a broadcast receiver class and when I receive a particular broadcast I would like to stop the foreground notification. So I tried context.stopForeground() but the intellisense did not show the method. How can we call the stopForeground() method in the broadcast receiver class ? public class Broad extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if(intent.getAction()==Const.ACTION_STOP) { // unable to call like this context.stopForeground();

How to open a specific activity based on Notification

痴心易碎 提交于 2019-12-12 01:52:24
问题 I am currently working on a reminders app in which the user gets a notification with the name of the reminder and is then redirected to an activity which contains the text of the reminder in detail. I am however, only able to redirect to the same activity each time. I am using this code : PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); notification.setLatestEventInfo(this, title, text, contentIntent); So this redirects to the

cancel Service when user clicks Notification

℡╲_俬逩灬. 提交于 2019-12-12 01:40:02
问题 Similar to this post I got a service that does some work in the background. When the service starts, I'm displaying a notification. Usually you can assing an intent to the notification that is triggered when the user clicks onto the notification. Mostly an activity is then started. But how can I use a notification to inform the background service that the user want's to cancel its operation? 回答1: You can have a BroadcastReceiver to stop the Service, which is triggered through the