android-pendingintent

Communication between Service and Activity each hosted in different process using PendingIntent

南笙酒味 提交于 2019-12-08 05:25:02
问题 I am starting a foreground service from a fragment which gets destroyed after call to startService() , which is a reason I can't use ResultReceiver or Messanger . So the option remains PendingIntent . How can I communicate between foreground service(hosted in different process) from any activity/fragment using PendingIntent? 回答1: You have two separate issues: How do you get data from the service process to the UI process? How do you get the data from whatever you did for #1 to whatever

How to connect an android widget to my android application? both are my Android applications

天涯浪子 提交于 2019-12-08 04:32:43
问题 I want to combine my widget and one of my android application.. Is it possible to do that? My plan is, once user open up my android widget, the widget will directly open up my android application? Is there any way how? I made some method here from my widget class: public class ExampleAppWidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int i = 0; i < appWidgetIds.length; i++) { int appWidgetId =

Geofence - problem in triggering 'GEOFENCE_NOT_AVAILABLE'

混江龙づ霸主 提交于 2019-12-08 02:25:49
问题 I do app with geofencing use and since I started to work with it I get to broadcastReceiver the transitions and when I turned off the GPS location I got an alert with code GEOFENCE_NOT_AVAILABLE and I started a service to reregister the geofences when I will turn on the GPS. Now I took a few days break and suddenly my broadcastReceiver doesn't get alerts when I turn off the GPS. I don't understand why? *when I enter/exit from location (like I defined in the geofences init) I trigger the

FusedLocationApi with PendingIntent is fired only once and its null

爱⌒轻易说出口 提交于 2019-12-08 00:20:44
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_IN_MILLISECONDS = 1000 * 30; //1 minute; /** * The fastest rate for active location updates. Exact.

PendingIntent of Notification don't call my Activity second time

无人久伴 提交于 2019-12-07 18:48:38
问题 I hope that receiving a push-notification (c2dm) reception display Notification. This Notification start, whith PendingIntent, an Activity that display a pop-up. This popup launch my application when clicking on the "ok" button. Here is the code executed at the reception of push-notification : private void dealMessage(Context context, Intent intent) { try { String message = intent.getExtras().getString("message"); Log.v("testc2dm","message : [" + message + "]"); //create bean of my

Notify users when they reach a location

最后都变了- 提交于 2019-12-07 16:33:25
问题 In the application I'm working on, one of the features is to notify the user when they reach a location that they have set prior. The code below is in addProximityAlert in Activity: final Intent intent = new Intent(PROX_ALERT_INTENT); final PendingIntent pendingIntent = PendingIntent.getBroadcast( InfoActivity.this, 0, intent, PendingIntent.FLAG_ONE_SHOT); LocationManager locationManager = (LocationManager) this .getSystemService(Context.LOCATION_SERVICE); locationManager.addProximityAlert(18

android - notification click - if app closed open activity, if app opened bring show current activity [duplicate]

Deadly 提交于 2019-12-07 12:08:55
问题 This question already has answers here : Resume application and stack from notification (7 answers) Closed 3 years ago . I have a service with an ongoing notification. in the app itself I have two activities - HomeActivity and SettingsActivity . Currently what I have is -> when the notification is clicked: If the app is closed -> open the HomeActivity . If the current showing activity is HomeActivity , bring it to front without creating a new one. Code: resultIntent = new Intent(context,

'startactivity called from non-activity context service' warning when launching intent from notification

别等时光非礼了梦想. 提交于 2019-12-07 07:51:49
问题 I've a service which starts a notification with startForeground() , I want the notification to launch an activity on click. The acitivty I want to launch defined as android:launchMode="singleTask" and usually runs before the service starts. Here is my pending intent creation code : Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE

Alarm manager not triggering alarms at exact time in android

人盡茶涼 提交于 2019-12-07 07:40:07
问题 I scheduled alarm using Calendar class as below Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY,1); cal.getTimeInMillis(); cal.set(Calendar.MINUTE,05); long TriggerMillis = cal.getTimeInMillis(); AlarmManager aManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); aManager.set(AlarmManager.RTC_WAKEUP, TriggerMillis,pIntent); where pIntent is an pending intent to proceed further when alarm triggers. The event triggers with few seconds delay. Is that any

Pending Intents for sending SMS not working well while sending many messages

丶灬走出姿态 提交于 2019-12-07 07:25:18
问题 I am Developing an App , In which I send SMS and I need to find if It's delivered or not. Every thing seems to be well if I send A message to a person. But In some situations I got wrong Information , for example , First I send A message to number 0000 (But It will not deliver) and after it I send a message to number 0001 and It delivers (message to 0000 is still not delivered) but I got a toast with : sms delivered to 0000(But only message to 0001 is delivered) , What Should I do to fix this