android-pendingintent

Android - DeleteIntent, how to use?

試著忘記壹切 提交于 2019-12-20 05:01:08
问题 I currently have a notification in my Android application that has a PendingIntent so that when it is clicked an activity is opened. I currently keep a counter for the notification, similar to the native missed calls notification. I can reset this counter to 0 when the notification is clicked. I also want to reset the counter to 0 when the user selects the "Clear all notifications" button. I have done a search and seen the way to do this is to use the DeleteIntent. But I cant figure out how

Intent with old extra in onCreate() for singleTask Activity

无人久伴 提交于 2019-12-19 17:37:59
问题 For example I created project with 2 activities: FirstActivity with android:launchMode="singleTask" flag and SecondActivity. At first user starts FirstActivity and after this SecondActivity will start on button click. From SecondActivity we create status bar notification. Intent intent = new Intent(SecondActivity.this, FirstActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(FirstActivity.ARG, true); NotificationCompat.Builder builder = new NotificationCompat

PendingIntent get requestCode

你说的曾经没有我的故事 提交于 2019-12-19 16:54:54
问题 I use an AlarmManager to start a service. When i set up the AlarmManager i use the PendingIntent and use a unique requestCode which is equal to a id row in my database. PendingIntent pendingIntent = PendingIntent.getBroadcast(SettingsActivity.this, lecture.getId(), myIntent, 0); How can I retrieve that id in my service when it starts? I basically need only the requestCode parameter. I want to use that id to retrieve data from my database and show it in a notification. I have implemented all

Location manager doesnt remove location updates! [duplicate]

那年仲夏 提交于 2019-12-19 10:32:28
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Android: how to cancel a request of Location update with intent? I am trying to disable a pending intent(broadcast) which I have previously created in a different activity but I can't get it to work. I've read that I should recreate the intent(with the same extras and everything), pass it as a parameter so that I can instantiate the pendingIntent and then pass the pendingIntent as a parameter to the location

Android PackageInstaller, re-open the app after it updates itself

随声附和 提交于 2019-12-19 02:52:09
问题 I'm developing an app that runs as Device Owner, and I want to build an automatic updater inside it. To do it I use the PackageInstaller, as I have the privileges to use it due to my Device owner position. private void installPackage(InputStream inputStream) throws IOException { notifyLog("Inizio aggiornamento..."); PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller(); int sessionId = packageInstaller.createSession(new PackageInstaller .SessionParams

Activity Recognition PendingIntent stop been called in the middle of the night

眉间皱痕 提交于 2019-12-18 17:34:36
问题 my application collects periodically Activity Recognition's Detected activity data. I implemented it exactly as described in the documentation , but with one minute interval. as long as the user is logged in - the application registered with a PendingIntent to receive updates from google play process.. please not lecture me about battery usage, network, and performance problem derived from request updates each minute, unless it have something to do with my problem: the problem: in some

putExtra using pending intent not working

穿精又带淫゛_ 提交于 2019-12-18 12:48:00
问题 I have written a code in my GCMIntentservice that sends push notifications to many users. I use the NotificationManager that will call DescriptionActivity class when the notification is clicked. I also send the event_id form the GCMIntentService to the DescriptionActivity protected void onMessage(Context ctx, Intent intent) { message = intent.getStringExtra("message"); String tempmsg=message; if(message.contains("You")) { String temparray[]=tempmsg.split("="); event_id=temparray[1]; } nm=

How to send data through PendingIntent to Broadcast?

偶尔善良 提交于 2019-12-18 11:24:54
问题 I'm trying to send via PendingIntent some extra data, like: MyMessage message; //... Intent intent; SmsManager sms = SmsManager.getDefault(); intent = new Intent(Constants.SENT_PLAIN); intent.putExtra(Constants.EXTRA_RAW_ID, message.getId()); //putting long id (not -1L) PendingIntent sentPI = PendingIntent.getBroadcast(activity, 0, intent, 0); intent = new Intent(Constants.DELIVERED_PLAIN); intent.putExtra(Constants.EXTRA_RAW_ID, message.getId()); PendingIntent deliveredPI = PendingIntent

Intent to resume a previously paused activity (Called from a Notification)

扶醉桌前 提交于 2019-12-18 11:05:04
问题 I'm developing an app which shows a notification to the user. The notification's objective is to make it easy to the user to return to the activity when the user is in another activity. I am using this code in my app to create and show the notification. notification = new Notification(R.drawable.icon, "Notify", System.currentTimeMillis()); notification.setLatestEventInfo(this, "App name", "App message", PendingIntent.getActivity( this, 0, new Intent(this, Main.class), PendingIntent.FLAG

Alarm “cancel” button not working correctly

做~自己de王妃 提交于 2019-12-18 09:36:29
问题 I have 2 buttons save and set alarm and cancel alarm which are meant to do exactly what they suggest. Inside onCreate declared variables final Intent alarmintent = new Intent(AlarmActivity.this, AlarmReceiver.class); final AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); final PendingIntent sender1 = PendingIntent.getBroadcast(getApplicationContext(), 2, alarmintent, PendingIntent.FLAG_UPDATE_CURRENT | Intent.FILL_IN_DATA); Code inside Cancel Button