android-pendingintent

How to call a non-activity method on Notification Click

百般思念 提交于 2019-12-23 13:08:54
问题 I have a java class MyClass which contains a method called callMethod . I want to call this method when user clicks on the notification Below is the code i used to generate the notification public class MainActivity extends AppCompatActivity { Button button; NotificationManager mNotifyMgr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button = (Button) findViewById(R.id.button); mNotifyMgr =

Multiple Pending Intents?

独自空忆成欢 提交于 2019-12-23 11:53:22
问题 My activity creates a couple of notifications. Here's how I'm currently doing it, on different resultIntents: PendingIntent resultPendingIntent = PendingIntent.getActivity( context, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT ); Now, since a flag is compulsory, I'm forced to select from the four flags. What do I do if I want all of them to work independently, and the newer notification isn't affected by the previous one. 回答1: A solution was found here: here. You've to use setAction on

Android click on notification does not open the attached Activity

*爱你&永不变心* 提交于 2019-12-23 11:43:32
问题 I want to open an Activity when I click on the notification from the Status bar. I have seen this answered on StackOverflow but none of these answers work for me. This issue is only seen on Lollipop devices and best way to reproduce is: 1. launch the app. 2. Back ground the app. 3. Receive a push notification. 4. Click on the notification and try with 3-4 push notifications. Below is my code: I have also tried the following: adding Intent.ACTION_MAIN Intent.CATEGORY_LAUNCHER to the intent

Passing data with a PendingIntent

限于喜欢 提交于 2019-12-23 09:37:38
问题 I am attempting to raise a notification that a message has arrived. I have added an action expecting an icon (smallredball) to show on the notification. I expect that if the user hits smallredball, main activity will startup and the activity, checking the extras bundle, will see the orders to do something different than if it were just started up normally. The notification shows on the target phone (running KitKat) along with the text but the smallredball icon never shows. When the user

How to persistently save PendingIntent provided by another application

浪尽此生 提交于 2019-12-23 08:50:07
问题 let's say I want to implement an app which exposes services to other apps (like Google Play Services..). potential apps would register to my special events associated with my services, and would be notified at the right time. I was thinking to implement this exactly like Google did with the Google Play services: thanks to Android Inter-Process Communication, other apps could bind to my app Service , and by that - pass to my app PendingIntent "callback" that I could execute for them at the

Android: PendingIntent from Notification doesn't trigger the onCreate() if bringing Activity back on Screen

…衆ロ難τιáo~ 提交于 2019-12-23 07:59:12
问题 guess I'm having some misunderstandigs with the Intent Flags.. What I'm trying to do is, I'm having a radio streaming applications, which has two Activities (PlayerApplication and SettingsScreen). I have a Service.class for Streaming which runs in the background, which holds a Notification as well (you can stop/start playback in the notification-overlay menu and the PlayerApplication). If the User clicks on the Notification, the PlayerApplicationActivity should be com back to screen.

Intent filterEquals and filterHashCode are no longer invoked when creating pending intents

给你一囗甜甜゛ 提交于 2019-12-23 04:56:08
问题 I create several notifications with similar pending intents but different values within. When clicking on any of the notifications, only the last registered intent is fired. It used to work in the past because the filterEquals() and filterHashCode() were invoked and this made the uniqueness possible. Now, when I put breakpoints in these methods, they aren't invoked anymore. Ideas on what happened? Thanks. 来源: https://stackoverflow.com/questions/13553911/intent-filterequals-and-filterhashcode

FusedLocationApi with PendingIntent is fired only once and its null

空扰寡人 提交于 2019-12-23 02:42:20
问题 Am working on an app that needs location update frequently even when its in the background. Following the documentation here, am working with pending intent not locationlistener. My code is below /** * Created by philip on 7/30/16. */ public class LocationService extends Service implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{ private GoogleApiClient mGoogleApiClient; private LocationRequest mLocationRequest; public static final long UPDATE_INTERVAL

How do I check if AlarmManager has an alarm set with FLAG_ONE_SHOT

北城余情 提交于 2019-12-23 02:30:58
问题 If I create a PendingIntent with FLAG_ONE_SHOT, a subsequent PendingIntent with FLAG_NO_CREATE returns null. AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context,AlarmService.class); PendingIntent pi = PendingIntent.getService(context,this.getId(),intent,PendingIntent.FLAG_ON_SHOT); GregorianCalendar alarmtime = new GregorianCalendar(now.get(GregorianCalendar.YEAR),now.get(GregorianCalendar.MONTH),now.get(GregorianCalendar.DAY_OF

Alarm Manager is not activating broadcast receiver?

試著忘記壹切 提交于 2019-12-22 14:59:30
问题 I am working on an application inwhich I am using AlarmManager for scheduling things. My Alarm is set. But this Alarm does not invoke BroadcastReceiver written to catch the event. I have searched a great deal but I have not found anything that solves the issue. I am posting my code, please have a look and see if I am missing something. AlarmManagerClass: public class ScheduleMessageManager { Context context; PendingIntent sender; AlarmManager am; public ScheduleMessageManager(Context context)