android-pendingintent

Notification RemoteView on click listener

三世轮回 提交于 2020-01-01 00:28:09
问题 So, after a lot of head scratching, I am at my wit's end. I have a media player RemoteViews in my notification and I would like to be able to access the play, pause, previous and next buttons. I know that setOnClickPendingIntent() will be used to communicate from the notification. However, I am left wondering how that will work. Is it possible to let the service handle the clicks? I have tried this, but in vain. I was trying to let me service handle the pause and resume of the player: rm =

Android: Does context affect filterEquals(), used to cancel alarm?

落爺英雄遲暮 提交于 2019-12-30 11:48:27
问题 To cancel an alarm, I use alarmManager.cancel(pendingIntent); which, according to android developers Removes any alarms with a matching Intent. Any alarm, of any type, whose Intent matches this one (as defined by filterEquals(Intent)), will be canceled. If it compares 2 pendingIntents which are constructed with a different context and the intents they use have a different context as well, but the classes they refer to are the same, does filterEquals(Intent) return true? So, pendingIntent1 has

Can a broadcastReceiver catch multiple broadcasts?

半腔热情 提交于 2019-12-29 04:23:08
问题 I am trying to create multiple proximity alerts but I cant get it to work... I think that the broadcast receiver gets overwritten and thus is handling only the last broadcast. So if I had two points close by only the one whose intent was created last will generate an alert... I read that I should use request codes but I have no idea on how to do that... My method for setting up the pending intents and the broadcast receiver... private void addProximityAlert(double latitude, double longitude,

Can't start activity from BroadcastReceiver on android 10

穿精又带淫゛_ 提交于 2019-12-28 06:39:30
问题 I updated my OS version to android 10 last night, and since then the startActivity function inside the broadcast receiver is doing nothing. This is how I try to start the activity based on the answer of CommonsWare: Intent i = new Intent(context, AlarmNotificationActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { // This is at least android 10... Log.d("Debug", "This is android 10"); // Start the

Problems with BroadcastReceiver and multiple proximity alerts

家住魔仙堡 提交于 2019-12-25 06:52:47
问题 I realize this question already exists, but I am having trouble implementing the solutions. I'm using these questions as guidlines: multiple proximity alert based on a service set 2 proximity alerts with the same broadcast Where I register the receiver: final String NEAR_YOU_INTENT = "neighborhood.crodgers.example.activities.PROXIMITY_ALERT"; IntentFilter filter = new IntentFilter(NEAR_YOU_INTENT); registerReceiver(new LocationReceiver(), filter); Where the proximity alerts are added (Note:

what should be the onLocationChanged content

空扰寡人 提交于 2019-12-25 04:22:45
问题 I know that this question is asked many times in SO,and I've tried to follow 20 web page content.. page 1 page 2 page 3 page 4 etc etc pages... Basically my code source is Androidhive.info My issue is-- in log cat it is displaying the location but it is not saving in my database.. I have a php file at server and I am calling it by httppost on button click..My motto is 1.On button click it should send the location(this task completed) 2.App should run in background and send location details in

Intent extra gets cleared out from unknown reason

三世轮回 提交于 2019-12-25 00:43:22
问题 I have Activity A which starts Activity B with following code: Intent intent = new Intent(this, B.class); intent.putExtra("foo", new MySerializableObject()); startActivity(intent); In B "foo" is received correctly and then I create PendingIntent to start itself after some time, you can think about it as some alarm clock app. Anyway the mysterious thing is that when I schedule this intent in following way: Intent intent = new Intent(context, B.class); intent.putExtra("bar", true);

change icon when textview is clicked in widget

戏子无情 提交于 2019-12-24 18:26:20
问题 I have create a widget in android , whenever i click on Widget TextView one service get starts but at the same time i want to change the icon which is shown on the right side. I can set a onclick over Widget TextView using remoteViews.setOnClickPendingIntent(R.id.widgetTxt,pendingIntent); but i don't know where i can change the icon when the TextView get clicks image @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) { // Here i am trying to

change icon when textview is clicked in widget

妖精的绣舞 提交于 2019-12-24 18:24:11
问题 I have create a widget in android , whenever i click on Widget TextView one service get starts but at the same time i want to change the icon which is shown on the right side. I can set a onclick over Widget TextView using remoteViews.setOnClickPendingIntent(R.id.widgetTxt,pendingIntent); but i don't know where i can change the icon when the TextView get clicks image @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager,int[] appWidgetIds) { // Here i am trying to

Now Playing Card Does Not Start the Desired Activity

好久不见. 提交于 2019-12-24 15:23:42
问题 I could not manage to start an activity from the Now Playing card. I am using the following code, but the NowPlayingActivity never gets called. Intent intent = new Intent(getApplicationContext(), NowPlayingCardActivity.class); PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), 99, intent, PendingIntent.FLAG_UPDATE_CURRENT); mSession.setSessionActivity(pi); and in the manifest file: <activity android:name=".NowPlayingCardActivity" /> I am taken to the main activity when I