android-pendingintent

Android notification start when ever I open app

本小妞迷上赌 提交于 2019-12-13 07:23:20
问题 I am adding notification to my app, Everyting is working fine if app is shut down, and it fires notification exactly as i want, but when ever i start app, and on create is called notification fires. If i leave app and start app again, notification will fire again. However, when ever i open my app notification fires. I do not want that behavior. This is a code for for notifications and i put code in onCreate : I know that i should move this from onCreate but where to move it? Is it possible to

Compilation error using PendingIntent

别来无恙 提交于 2019-12-13 06:47:47
问题 So I'm working on a chunk of code that will allow me to run an app out of the Status bar at the top I'm a good way into it and almost finished. I just need a second opinion on why my "PendingIntent.getActivity(this,that,next,thing);" Its not compiling. Here's the code import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; public class NotifyMe extends

How to pass a URL link in notification, and on click it should get open in webview?

对着背影说爱祢 提交于 2019-12-13 04:07:12
问题 I am working on a notification project, my requirement is to pass a url link on notification and when user click on notification so it navigates to some activity X and opens that url in the web view which is there in activity X. This is what i am doing ... Context context = this.getApplicationContext(); notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); // Intent mIntent = new Intent(this, MainActivity.class); Intent notificationIntent = new

Null Value in getStringExtra()

倾然丶 夕夏残阳落幕 提交于 2019-12-13 03:37:55
问题 I am trying to build a notification service using the firebase Messaging Service. Problem is When I am clicking the notification It takes me to the correct intent but my App bar title is not updating properly. I am passing the username in the intent but in getExtra() of the Intent, it returns null. I am getting the correct userId but not getting correct name. My code for notification builder looks like this: NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this, CHANNEL_ID

Why does a PendingIntent trigger onCreate even though FLAG_NO_CREATE is set

时间秒杀一切 提交于 2019-12-13 02:35:44
问题 One of my Activities starts an AsyncTask and adds an ongoing notification to the notification area. This notification receives updates from within the AsyncTask . I did this so the users are able to leave the Activity with the Home button and still receive progress updates during a long running operation. Clicking the notification should return the user to this activity. The problem is that no matter what, it seems that the old activity is never used again, but instanciated new (while the

getParcelableExtra always null on Pending Intent, but not Intent

倾然丶 夕夏残阳落幕 提交于 2019-12-12 23:02:36
问题 I'm new to Java let alone Android development. I have no coding background, but thought I'd start with something 'simple' like an alarm clock. So now I'm writing an alarm clock, and I want to update the alarms to be inactive if they aren't repeating after they go off. When I pass a parcelable AlarmClass (my alarm object) to the alarm set screen with an intent, it passes just fine. When I pass the same AlarmClass to an intent, and put it in a PendingIntent in the Alarm Manager and then try to

Launch activity when user taps on a notification from the lockscreen

大憨熊 提交于 2019-12-12 17:06:35
问题 I want to be able to tap on a notification when the device is locked and launch an activity without unlocking the device. I added some flags to the activity in the onCreate() method that allow the activity to be displayed when the device is locked: Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); window.addFlags

Passing data from widget to app

怎甘沉沦 提交于 2019-12-12 13:08:57
问题 I'm developing a widget for my app and I'd like to pass specific data from the widget to the app. The user can add multiple versions of the widget and I need to detect which widget it is coming from so I can show specific information in the app. What I have works so far, but only if I exit my app completely (repeatedly pressing the back button), otherwise it doesn't seem to be detecting the data being passed in. This the code I have to pass the data from the widget to the app: public class

Pending intent with different intent but same ID

孤人 提交于 2019-12-12 10:45:59
问题 I have two pending Intent to use with Alarm Manager one is: Intent i = new Intent(context, TriggerAlarm.class); PendingIntent pi =PendingIntent.getBroadcast(context,0,i,PendingIntent.FLAG_CANCEL_CURRENT); and the other is: Intent i = new Intent(context, TriggerNotification.class); PendingIntent pi = PendingIntent.getBroadcast(context,0, i,PendingIntent.FLAG_CANCEL_CURRENT); I use these two in different methods in my application my question is: Are these pendingIntents differnt from each other

Simplest way to use / create a PendingIntent

微笑、不失礼 提交于 2019-12-12 09:18:29
问题 Maybe there's something really simple that I don't see. I'm trying to call a method from some API, and this method asks for a PendingIntent to send me asynchronously some value. I've read the doc and examples for half an hour, and can't wrap my head around a simple way to do it. More precisely, I want to call the ActivityRecognitionApi. To illustrate, here's how I receive the location from a similar api: LocationServices.FusedLocationApi.requestLocationUpdates( mGoogleApiClient,