[android-beginners] Re: ATTENTION: Android-Beginners will be permanently disabled on August 9 2010
AP == Alessandro Pellizzari a...@amiran.it writes: AP Too many, I agree, but this one was official, and was easily usable, AP being a mailing list. AP I would prefer a NNTP newsgroup, but a ml is good too. AP A forum or a website? Not so... This mailing list, along with many, many others can be access via NNTP using gmane. Pretty much any mailing list I care to follow is on gmane and, if it isn't, it be easily added. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For more information about this change, please read [http://goo.gl/xkfl] or visit the Group home page. Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: GPS satellite icon
Bret, Is your hack only required for continuous GPS monitoring? What abotu if you request updates only when the location has changed by a certain distance? Does it keep the GPS on continuously just so it knows whether the you have moved the required distance? If so, it sounds like Id be better off using your hack. ...Jake BF == Bret Foreman bret.fore...@gmail.com writes: BF Actually, this is not true with my hack. I did a comparison of BF battery drain with and without GPS running using 10 second BF updates and the difference in drain between off and on was less BF than 10% on my Droid phone. BF On Jul 23, 8:42 am, cellurl gpscru...@gmail.com wrote: GPS is such a power hog, no way around it. Physics! Not to soapbox, but there are a bunch of car apps that will require putting your Android in a cradle on your car dashboard. Why? Power. Only in a cradle will GPS be left on without draining the battery. Sooo, please Android, make hostmode-USB a priority so we can build car apps: self-steering, self-braking, stay-awake apps jp BF -- BF You received this message because you are subscribed to the Google BF Groups Android Beginners group. BF NEW! Try asking and tagging your question on Stack Overflow at BF http://stackoverflow.com/questions/tagged/android BF To unsubscribe from this group, send email to BF android-beginners+unsubscr...@googlegroups.com BF For more options, visit this group at BF http://groups.google.com/group/android-beginners?hl=en -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Checking for App before Launching
When my user clicks on my AppWidget, I want to launch either my own provided activity or an activity from a different app if that app is installed. My own activity is a stripped down version of the information that can be displayed by that other application. If that other application is available, I'd prefer to launch it in instead of my own. I may include this as a preference option and allow the user to decide which activity to launch. How can I check whether a specific app is installed before attempting to launch it (or before including it in my preferences) and only launch my own activity if that app is not available? Thanks. ...Jake -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Flurry and AppWidgets
Mark, So you call dispatch() from a service upon every call to onUpdate? ...Jake w == whitemice markbr...@zedray.co.uk writes: w Hi Jake w Assuming you are talking about Android Home Screen Widgets, I had w the same issue which I blogged here: w http://blog.zedray.com/2010/05/01/tracking-a-android-home-screen-widget/ w I still haven't gotten a response from Flurry, so I suggest you w consider the Google Analytics API. While this offers fewer w features relevant for application developers, it does provide a w dispatch() method which allows you to manually workaround the w widget life cycle issue. Let me know how this works for you. w Regards w Mark -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] RTC vs RTC_WAKEUP
What does it mean with RTC that the pending intent is fired but the device does not wake up as opposed to RTC_WAKEUP where device does wake up? If the device does not wakeup does that mean, simply, that the screen does not turn on but that my code still executes? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Canceling an Alarm in an AppWidget
My AppWidget's onEnabled method creates two PendingIntents. The first is to get location updates and the second is for an ELAPSED_REALTIME alarm. The two PendingIntents are declared as private class-level variables so that I can access them later from different methods (obviously). I'm having trouble canceling these PendingIntents and it looks like its because the variable has become null. In the case of location updates, I crash when I execute LocationManager.removeUpdates. In the case of the alarm, I do not crash but the alarm is not canceled. I tried putting my cancel code in onDisabled and onDeleted (not at the same time) but it didn't work. Any suggestions? My code looks as follows: public void onDeleted(Context context, int[] AppWidgetIds) { Log.d(ZMAppWidget, onDeleted); // cancel location updates LocationManager lm = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); lm.removeUpdates(piLocation); // cancel the alarm used to update the time AlarmManager alarms = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); alarms.cancel(piAlarm); } Thanks. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Question Using a Service with an Appwidget
As recommended I am using a service to update my AppWidget. The service is started in onUpdate and also in onReceive upon receipt of specific intents. My question is simple: am I supposed to do anything to manage the lifecycle of that service? Should I ever stop it or do anything else explicit with it as I would, for example, with an alarm where it has to be canceled when you are done? Or will Android take care of if for me? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Canceling an Alarm in an AppWidget
Kostya, How can it be transient? Doesn't the instance have to remain in existence for as long as the AppWidget exists on the Home Screen? Clearly, I can do as you suggest; I'd just like to understand why it's necessary. Thanks. ...Jake KV == Kostya Vasilyev kmans...@gmail.com writes: KV Jake, KV AppWidgetProviders are transient, you can't store any data in KV these objects. They are created by Android as necessary and are KV destroyed, from what I see with my widgets, quite aggressively. KV Canceling an alarm doesn't require the same Java object you used KV to set an alarm. KV Just create another PendingIntent with the same values, and call KV cancel() with this new object. KV This will remove the need for storing data in AppWidgetProvider KV instance variables, which you can't do. KV -- Kostya KV 15.07.2010 19:53, Jake Colman пишет: My AppWidget's onEnabled method creates two PendingIntents. The first is to get location updates and the second is for an ELAPSED_REALTIME alarm. The two PendingIntents are declared as private class-level variables so that I can access them later from different methods (obviously). I'm having trouble canceling these PendingIntents and it looks like its because the variable has become null. In the case of location updates, I crash when I execute LocationManager.removeUpdates. In the case of the alarm, I do not crash but the alarm is not canceled. I tried putting my cancel code in onDisabled and onDeleted (not at the same time) but it didn't work. Any suggestions? My code looks as follows: public void onDeleted(Context context, int[] AppWidgetIds) { Log.d(ZMAppWidget, onDeleted); // cancel location updates LocationManager lm = (LocationManager) context .getSystemService(Context.LOCATION_SERVICE); lm.removeUpdates(piLocation); // cancel the alarm used to update the time AlarmManager alarms = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); alarms.cancel(piAlarm); } Thanks. KV -- KV Kostya Vasilev -- WiFi Manager + pretty widget -- KV http://kmansoft.wordpress.com KV -- KV You received this message because you are subscribed to the Google KV Groups Android Beginners group. KV NEW! Try asking and tagging your question on Stack Overflow at KV http://stackoverflow.com/questions/tagged/android KV To unsubscribe from this group, send email to KV android-beginners+unsubscr...@googlegroups.com KV For more options, visit this group at KV http://groups.google.com/group/android-beginners?hl=en -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Implementing a Service - Call down to super?
When extending Service with your own Service, should you be calling down to the super implementation of the methods that are being overridden? If so, do you do it before or after you've invoked your own code? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Implementing a Service - Call down to super?
Dan, Thanks but that's not quite helpful! :-) I have my own onCreate and onStart and onDestroy methods that do my service-specific actions. Do I need to also invoke the super-class methods to keep Android happy? And, if so, do I do it before or after I do my own work? ...Jake D == DanH danhi...@ieee.org writes: D Maybe, maybe not. It depends on what you want to do. D On Jul 15, 2:46 pm, Jake Colman col...@ppllc.com wrote: When extending Service with your own Service, should you be calling down to the super implementation of the methods that are being overridden? If so, do you do it before or after you've invoked your own code? -- Jake Colman -- Android Tinkerer D -- D You received this message because you are subscribed to the Google D Groups Android Beginners group. D NEW! Try asking and tagging your question on Stack Overflow at D http://stackoverflow.com/questions/tagged/android D To unsubscribe from this group, send email to D android-beginners+unsubscr...@googlegroups.com D For more options, visit this group at D http://groups.google.com/group/android-beginners?hl=en -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Implementing a Service - Call down to super?
Justin, What you saying is certainly true generically. But I am specifically talking about a class as follows: public class JakeService extends Service { } In example code I don't think I usually see calls up to the super implementations. That seems wrong. So when extending the Service class do you call super before or after you do your own work? Wouldn't the answer to this question be the same regardless of what my Service implementation does? ...Jake JA == Justin Anderson janderson@gmail.com writes: JA But DanH is right, it totally depends on what you want to do. It JA also depends on what super does... If your subclass is setting JA information that is also set by super then chances are you would JA want to call super first. If what super does varies based on JA settings in your implementation, then you would want to call JA super last. If there is no such relationship then it doesn't JA matter when you call. JA Also, IMHO, you would only want to skip calling super in JA extremely rare circumstances. JA And, technically speaking, you would be calling up to the super JA implementation, but that's just semantics... :-) JA -- JA There are only 10 types of people in the world... JA Those who know binary and those who don't. JA -- JA On Thu, Jul 15, 2010 at 1:54 PM, DanH danhi...@ieee.org wrote: Maybe, maybe not. It depends on what you want to do. On Jul 15, 2:46 pm, Jake Colman col...@ppllc.com wrote: When extending Service with your own Service, should you be calling down to the super implementation of the methods that are being overridden? If so, do you do it before or after you've invoked your own code? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.comandroid-beginners%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en JA -- JA You received this message because you are subscribed to the Google JA Groups Android Beginners group. JA NEW! Try asking and tagging your question on Stack Overflow at JA http://stackoverflow.com/questions/tagged/android JA To unsubscribe from this group, send email to JA android-beginners+unsubscr...@googlegroups.com JA For more options, visit this group at JA http://groups.google.com/group/android-beginners?hl=en -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Flurry and AppWidgets
I am familiar with using Flurry with Activities and calling FlurryAgent.onStartSession() in the activity's onStart() method and calling FlurryAgent.onEndSession in the activity's onStop() method. What would be the best way to do the same thing if I want to use Flurry with my appwidget? Should I use the onEnabled()/onDisabled() methods or should I use onUpdate() since the user may never delete my appwidget and I won't know he's still using it? Or maybe onUpdate() and onDisabled() but then I won't be matching my start/end sessions. If my appwidget has a configuration activity or some other displayed activity I can obviously use flurry there. But how about in the appwidget itself? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Using TableView with a ListView
I'd like to create a table with two rows (each containing one spanned TextView) followed by a list of rows, each containing two TextViews. Do I simply create a TableRow containing a named ListView containing two named TextViews? If I then populate an adapter will TableView realize that I have a sequence of TableRows? Is it really that simple? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Difference Between Two Times
I have a Date variable which, according to the Javadoc, represents a specific moment in time. I need to compare that time with the current time so that I can do something if the current time is within X minutes of the time represented by the Date. How the heck can I figure this out? I know this is almost more of a Java question then it is an Android question but I'd appreciate any instance. Thanks. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Clicking in an AppWidget
I know how to write code that would launch an activity when a button is pressed on my appwidget. I would prefer, however, to not dedicate real-estate for a button. Is there a way to launch an activity simply by clicking anywhere in the appwidget? If so, is that a violation of Android standards? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Location Provider Questions
My widget needs to know its location but does not care whether it gets it from the GPS or the network. If I can get a finer location from the GPS that's fine. But if the GPS is not enabled or does not exist in the device, than I will use what I can get. I have some questions related to this: 1) Do I need both 'fine' and 'coarse' permissions to indicate that I can use both? Or will 'fine' also use the network if the GPS is not available. I don't want the user to think that a GPS is required in order for the application to work. But I do need to get lat/long one way or the other. 2) Is best practice still to do a backwards search through the list of available providers and to use the best one I find? 3) When setting up the location listener or intent to track location changes you have to specify the provider to use. But what if want to simply use the cheapest provider available? Thanks. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Problem Using Geocoder
T == TreKing treking...@gmail.com writes: T On Fri, Jun 25, 2010 at 8:23 AM, Jake Colman col...@ppllc.com wrote: Can anyone tell me what this means? As an aside, I wonder if this could be related to why Google Maps cannot show me my location and the Browser says location unavailable. T No sure, but based on you maps not having location and browser, error, T probably there is no GPS functionality. Are you using the emulator? Yes, I am using the emulator and, yes, the emulator was created with a GPS. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Appwidget Getting Location Updates
I would like my appwidget to get updates upon a change of location but I have a few questions. 1) I start a service in the appwidget's onUpdate() method. Is it appropriate to have location updates processed by the same service? 2) When using requestLocationUpdates() am I better off to use the Listener form of the API or the PendingIntent form of the API? To use the PendingIntent, I need to have an Activity, correct? And in this instance I don't, correct? So can the Service class create and use a Listener? Thanks. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Problem Using Geocoder
T == TreKing treking...@gmail.com writes: T On Wed, Jun 30, 2010 at 8:44 AM, Jake Colman col...@ppllc.com wrote: Yes, I am using the emulator and, yes, the emulator was created with a GPS. T Did you use DDMS to send the emulator a position? Yes. And a simple program that a Location Listener gets the GPS updates. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Appwidget Getting Location Updates
Kostya, I already start a service to do the initial update of the widget. Do I just start the same service again from within the appwidget's event handler for the broadcast event? As a side question, what does the service do after it is started? Does it just hang around wasting resources? How does the service know that it has done its job (updated the appwidget display) and that it has no more work to do? ...Jake KV == Kostya Vasilyev kmans...@gmail.com writes: KV Jake, KV PendingIntents are not limited to launching activites. When a KV PendingIntent fires, it just fires - the results of it firing KV depend on how the PI was created. KV If it's a broadcast event, it can be handled anywhere, and KV depends on where / how a handler for this broadcast event is KV defined. KV The easiest thing is to add a handler for this event to your KV AppWidgetProvider, this can be done in the manifest (since AWP is KV a BroadcastListener). Then, if building an widget update is not KV instant, use a Service to built it. KV -- Kostya KV 30.06.2010 23:41, Jake Colman пишет: I would like my appwidget to get updates upon a change of location but I have a few questions. 1) I start a service in the appwidget's onUpdate() method. Is it appropriate to have location updates processed by the same service? 2) When using requestLocationUpdates() am I better off to use the Listener form of the API or the PendingIntent form of the API? To use the PendingIntent, I need to have an Activity, correct? And in this instance I don't, correct? So can the Service class create and use a Listener? Thanks. KV -- KV Kostya Vasilev -- WiFi Manager + pretty widget -- KV http://kmansoft.wordpress.com KV -- KV You received this message because you are subscribed to the Google KV Groups Android Beginners group. KV NEW! Try asking and tagging your question on Stack Overflow at KV http://stackoverflow.com/questions/tagged/android KV To unsubscribe from this group, send email to KV android-beginners+unsubscr...@googlegroups.com KV For more options, visit this group at KV http://groups.google.com/group/android-beginners?hl=en -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Problem Using Geocoder
I am trying to use the Geocoder class to the get the address of the location specified by latitude and longitude. logcat is showing the following: LocationMasfClient E reverseGeocode(): no feature in GLocation Can anyone tell me what this means? As an aside, I wonder if this could be related to why Google Maps cannot show me my location and the Browser says location unavailable. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Triggering an AppWidget Update
I have some questions about the correct approach for updating an AppWidget's display. Since this is a beginners forum, please let me state what I already do know: 1) I can use android::updatePeriodMillis to specify the update interval. When this interval has elapsed the phone is woken up. Intervals of less than one hour are not a good idea. 2) Updates can be triggered by an alarm that will not actually wake up the phone. What I'm confused about is how/why/when to trigger an update. Let's say I am creating an AppWidget that will display the time of my next appointment. The widget needs to know the current time and the time of my next appointment. When the current time is after the current appointment the widget has to display the time of the next appointment. For this widget to work it must be regularly checking the time and the calendar since at any minute it might be time to display the next appointment. Does this mean I have to update the widget's display every minute? Clearly not, but how else? In actuality, I only really need to update the display if the user is looking at the screen. But do we only update if the screen is active? If so, what about if that update is a time-consuming process? The UI would then appear non-responsive. So what the is correct approach for this kind of problem? Thanks! -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Triggering an AppWidget Update
MM == Mark Murphy mmur...@commonsware.com writes: MM On Thu, Jun 24, 2010 at 10:31 AM, Jake Colman col...@ppllc.com wrote: For this widget to work it must be regularly checking the time and the calendar since at any minute it might be time to display the next appointment. Does this mean I have to update the widget's display every minute? Clearly not, but how else? MM Update the display when the data changes. That will occur at the MM earlier of: MM -- when the time for the previous event passed, so you would need to MM show the next event MM -- when the Google Calendar GData APIs tell you there is a new event MM that is earlier than the one you are presently showing But do we only update if the screen is active? MM Ideally, no, you update when the data changes. Mark and Kostya, Thanks for your (amazingly quick) replies. So I guess the best approach would be to set an alarm to trigger at the time of the next appointment so that I wake up and get the next time to display. That makes sense and limits the number of times that I wake up to do an update. But let's say the appwidget displays the amount of time remaining until the next appointment. Since that data changes all the time, how does one structure the widget update in that instance? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Triggering an AppWidget Update
KV == Kostya Vasilyev kmans...@gmail.com writes: KV Jake, KV There are two issues here: KV - Getting notifications when appointment data changes. If the appointment KV database is your own, set up an intent to be fired whenever there is a KV change. If you are using the built-in calendar, there is got to be a way, too KV - I just don't have any pointers not having used this API. KV - Time until next appointment changes with real wallclock time, so it would KV have to be updated (every minute? every second?). This is a UI KV design decision - do you think your users prefer to see time til KV next appointment with 1-second accuracy, at the expense of KV possibly poor battery life, or would they be happy with 1-minute KV resolution, or perhaps just time of next appointment, updated a KV few times a day? Kostya, This is actually a theoretical discussion since I'm trying to understand how this type of problem, as opposed to this actual problem, can be solved. If the data to be updated is fixed, then it sounds like you would want an intent to be fired when the data changes. So in my first example, the problem can be solved by firing an intent when the appointment time has passed so that you get the time of the next appointment or forcing an update when the a new appointment is added. But in the second example, would it be appropriate to update every minute? But Android 2.2 only allows an update every 30 minutes. Do you set an alarm to trigger even minute or would that also drain the battery? Do you trigger an update only when the screen is turned on? Can that even be detected? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Problem with AppWidget Using a Service
I am trying to create a simple AppWidget using a service to initialize the content in the onUpdate() method. The data is not being refreshed and logcat shows me the following warning: AppWidgetService W updateAppWidgetProvider: provider doesn't exist: ComponentInfo{com.jnc.zmanminder/com.jnc.zmanminder.ZMUpdateService} I must be missing something obvious but I cannot figure it out. My AppWidget class (edited for brevity) looks as follows: public class ZmanMinderAppWidget extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { context.startService(new Intent(context, ZMUpdateService.class)); } } My Service class (edited for brevity) looks as follows: public class ZMUpdateService extends Service { public void onStart(Intent intent, int startId) { RemoteViews updateViews = buildUpdate(this); ComponentName thisWidget = new ComponentName(this, ZMUpdateService.class); AppWidgetManager manager = AppWidgetManager.getInstance(this); manager.updateAppWidget(thisWidget, updateViews); } public IBinder onBind(Intent arg0) { return null; } public RemoteViews buildUpdate(Context context) { Time time = new Time(); time.setToNow(); RemoteViews views = new RemoteViews(context.getPackageName(),R.layout.widget); views.setTextViewText(R.id.time, time.format(%I:%M%p)); return views; } } The ZMUpdateService service is defined in my manifest file. Thanks for any help. ...Jake -- Jake Colman | Director, Software Development Principia Partners LLC 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770 t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929 e: col...@ppllc.com | w: www.principiapartners.com Credit technology innovation awards winner 2008 and 2009 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Problem with AppWidget Using a Service
Kostya, Thanks. That worked like a charm. I noticed in sample AppWidget code that does not use a service, that it iterates the appWidgetIds array so that it updates all instances of the widget. However, in sample code that uses a Service, that iteration is not done. Is that because it is not needed for some reason? How would one update multiple instances using a service-based solution? Thanks. ...Jake KV == Kostya Vasilyev kmans...@gmail.com writes: KV Jake, KV The error is in the way your code instantiates ComponentName. KV Instead of: KV ComponentName thisWidget = new ComponentName(this, ZMUpdateService.class); KV Do this: KV ComponentName thisWidget = new KV ComponentName(this,*ZmanMinderAppWidget*.class); KV The error message was trying to convey same thing... KV -- Kostya KV 23.06.2010 17:39, Jake Colman ?: I am trying to create a simple AppWidget using a service to initialize the content in the onUpdate() method. The data is not being refreshed and logcat shows me the following warning: AppWidgetService W updateAppWidgetProvider: provider doesn't exist: ComponentInfo{com.jnc.zmanminder/com.jnc.zmanminder.ZMUpdateService} I must be missing something obvious but I cannot figure it out. My AppWidget class (edited for brevity) looks as follows: public class ZmanMinderAppWidget extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { context.startService(new Intent(context, ZMUpdateService.class)); } } My Service class (edited for brevity) looks as follows: public class ZMUpdateService extends Service { public void onStart(Intent intent, int startId) { RemoteViews updateViews = buildUpdate(this); ComponentName thisWidget = new ComponentName(this, ZMUpdateService.class); AppWidgetManager manager = AppWidgetManager.getInstance(this); manager.updateAppWidget(thisWidget, updateViews); } public IBinder onBind(Intent arg0) { return null; } public RemoteViews buildUpdate(Context context) { Time time = new Time(); time.setToNow(); RemoteViews views = new RemoteViews(context.getPackageName(),R.layout.widget); views.setTextViewText(R.id.time, time.format(%I:%M%p)); return views; } } The ZMUpdateService service is defined in my manifest file. Thanks for any help. ...Jake KV -- KV Kostya Vasilev -- WiFi Manager + pretty widget -- KV http://kmansoft.wordpress.com KV -- KV You received this message because you are subscribed to the Google KV Groups Android Beginners group. KV NEW! Try asking and tagging your question on Stack Overflow at KV http://stackoverflow.com/questions/tagged/android KV To unsubscribe from this group, send email to KV android-beginners+unsubscr...@googlegroups.com KV For more options, visit this group at KV http://groups.google.com/group/android-beginners?hl=en -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Problem with AppWidget Using a Service
Kostya, That makes perfect sense. It seems like a service-based update is really the right way to go. It avoids any potential timeout issue and is allows updating of all widgets at once. Thanks for your help. ...Jake KV == Kostya Vasilyev kmans...@gmail.com writes: KV Jake, KV onUpdate is passed an explicit list of just the widget ids that KV need to be updated. Supposedly, there could be widgets that KV belong to this provider but don't need updating (e.g. on a KV scrolled-off home screen portion). KV Pushing a RemoveViews object to a paricular widget is done by KV calling: KV manager.updateAppWidget(int widgetId, updateViews); KV It's also possible to update all widgets that belong to a KV particular widget provider, and this is the approach KV service-based widgets take, supposedly to avoid paying service KV start-up costs for each widget id. KV In this case, a single RemoteViews is pushed to all widgets with KV a single call to: KV manager.updateAppWidget(ComponentName thisWidget, updateViews); KV -- Kostya KV 23.06.2010 18:57, Jake Colman пишет: Kostya, Thanks. That worked like a charm. I noticed in sample AppWidget code that does not use a service, that it iterates the appWidgetIds array so that it updates all instances of the widget. However, in sample code that uses a Service, that iteration is not done. Is that because it is not needed for some reason? How would one update multiple instances using a service-based solution? Thanks. ...Jake KV == Kostya Vasilyevkmans...@gmail.com writes: KV Jake, KV The error is in the way your code instantiates ComponentName. KV Instead of: KV ComponentName thisWidget = new ComponentName(this, KV ZMUpdateService.class); KV Do this: KV ComponentName thisWidget = new KV ComponentName(this,*ZmanMinderAppWidget*.class); KV The error message was trying to convey same thing... KV -- Kostya KV 23.06.2010 17:39, Jake Colman ?: I am trying to create a simple AppWidget using a service to initialize the content in the onUpdate() method. The data is not being refreshed and logcat shows me the following warning: AppWidgetService W updateAppWidgetProvider: provider doesn't exist: ComponentInfo{com.jnc.zmanminder/com.jnc.zmanminder.ZMUpdateService} I must be missing something obvious but I cannot figure it out. My AppWidget class (edited for brevity) looks as follows: public class ZmanMinderAppWidget extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { context.startService(new Intent(context, ZMUpdateService.class)); } } My Service class (edited for brevity) looks as follows: public class ZMUpdateService extends Service { public void onStart(Intent intent, int startId) { RemoteViews updateViews = buildUpdate(this); ComponentName thisWidget = new ComponentName(this, ZMUpdateService.class); AppWidgetManager manager = AppWidgetManager.getInstance(this); manager.updateAppWidget(thisWidget, updateViews); } public IBinder onBind(Intent arg0) { return null; } public RemoteViews buildUpdate(Context context) { Time time = new Time(); time.setToNow(); RemoteViews views = new RemoteViews(context.getPackageName(),R.layout.widget); views.setTextViewText(R.id.time, time.format(%I:%M%p)); return views; } } The ZMUpdateService service is defined in my manifest file. Thanks for any help. ...Jake KV -- KV Kostya Vasilev -- WiFi Manager + pretty widget -- KV http://kmansoft.wordpress.com KV -- KV You received this message because you are subscribed to the Google KV Groups Android Beginners group. KV NEW! Try asking and tagging your question on Stack Overflow at KV http://stackoverflow.com/questions/tagged/android KV To unsubscribe from this group, send email to KV android-beginners+unsubscr...@googlegroups.com KV For more options, visit this group at KV http://groups.google.com/group/android-beginners?hl=en KV -- KV Kostya Vasilev -- WiFi Manager + pretty widget -- KV http://kmansoft.wordpress.com KV -- KV You received this message because you are subscribed to the Google KV Groups Android Beginners group. KV NEW! Try asking and tagging your question on Stack Overflow at KV http://stackoverflow.com/questions/tagged/android KV To unsubscribe from this group, send email to KV android-beginners+unsubscr...@googlegroups.com KV For more options, visit this group at KV http://groups.google.com
[android-beginners] Re: Problem with AppWidget Using a Service
MM == Mark Murphy mmur...@commonsware.com writes: MM If it helps, here is a complete app widget example: MM http://github.com/commonsguy/cw-advandroid/tree/master/AppWidget/Microblog/ MM It assumes you have an identi.ca account you can use. Indeed it does and indeed I do. I am already a subscriber to your excellent books. -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Problem with AppWidget Using a Service
MM == Mark Murphy mmur...@commonsware.com writes: MM If it helps, here is a complete app widget example: MM http://github.com/commonsguy/cw-advandroid/tree/master/AppWidget/Microblog/ MM It assumes you have an identi.ca account you can use. Mark, Although it says Microblog, the example code still references Twitter. Is this correct? If so, what/where do I download to resolve the winterwell.jtwitter.Twitter import? -- Jake Colman -- Android Tinkerer -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Emulator Unable to Access Location
The browser works fine so networking does not seem to be the issue. My little GPS app correctly display lat/long as pushed from DDMS or telnet. But Maps and the Browser both say cannot access location. Terrific... :-( Incidentally, I have the same issue whether I use a pure Ubuntu 10.04 laptop or a Ubuntu 10.04 virtual box running under XP. Is it possible its a Ubuntu 10.04 issue? I suppose I can create a Ubuntu 9.10 virtual box and see what happens. d == davemac davemac...@gmail.com writes: d So your app is getting the lat/long from DDMS, but you're not d seeing any maps displayed? Maps come from the Google API over the d Internet. Is there a chance that you don't have networking d available to your emulator? Other than location, does the browser d function correctly? I'm also at a loss as to why you're not able d to see your location. Good luck! d - dave d On Jun 18, 2:59 pm, Mark Murphy mmur...@commonsware.com wrote: On Fri, Jun 18, 2010 at 8:42 AM, Jake Colman col...@ppllc.com wrote: This is really odd. I started from scratch using a new computer (a Ubuntu virtualbox guest under WinXP). I downloaded the SDK, created an AVD, started Maps and pushed a location. Maps still says temporarily unable to access location but my small app that display location changes displays the new latitude and longitude. Any idea what I can be doing wrong? Off the top of my head, I can't think of any particular problems. Nested emulation environments (qemu in Ubuntu in XP) is a little odd, but if you are getting the fix, I don't know why the Maps app would not. -- Mark Murphy CommonsWare mmur...@commonsware.comhttp://commonsware.com d -- d You received this message because you are subscribed to the Google d Groups Android Beginners group. d NEW! Try asking and tagging your question on Stack Overflow at d http://stackoverflow.com/questions/tagged/android d To unsubscribe from this group, send email to d android-beginners+unsubscr...@googlegroups.com d For more options, visit this group at d http://groups.google.com/group/android-beginners?hl=en -- Jake Colman | Director, Software Development Principia Partners LLC 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770 t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929 e: col...@ppllc.com | w: www.principiapartners.com Credit technology innovation awards winner 2008 and 2009 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Emulator Unable to Access Location
MM == Mark Murphy mmur...@commonsware.com writes: MM Jake Colman wrote: My emulator is running Android 1.6. And the Maps appplication is ignoring the fix. :-( MM FWIW, my 1.6 emulator works just fine with Maps. As before: start MM Maps, push a location from the emulator, and it shows My MM Location. This is really odd. I started from scratch using a new computer (a Ubuntu virtualbox guest under WinXP). I downloaded the SDK, created an AVD, started Maps and pushed a location. Maps still says temporarily unable to access location but my small app that display location changes displays the new latitude and longitude. Any idea what I can be doing wrong? -- Jake Colman | Director, Software Development Principia Partners LLC 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770 t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929 e: col...@ppllc.com | w: www.principiapartners.com Credit technology innovation awards winner 2008 and 2009 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Widget Background For One Cell Widget
I'm looking for a simple widget background that can be used for a one cell widget. The background that I found, which are scaleable, have huge margins so that there is not enough usable space when its sized at one cell. Barring a specific answer to this question, how does one create a background for use with a widget? Thanks. ...Jake -- Jake Colman | Director, Software Development Principia Partners LLC 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770 t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929 e: col...@ppllc.com | w: www.principiapartners.com Credit technology innovation awards winner 2008 and 2009 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Emulator Unable to Access Location
I'm sure that I'm doing something obviously wrong but I cannot figure it out. I am using a Android 1.6 emulator with the Google API. No matter what I try the emulator cannot determine its location. Both the browser and the Maps application both say that the location is unavailable. The emulator is configured with GPS. I used DDMS to send GPS coordinates. I wrote a small GPS application that displays the current location whenever the location changes. The application confirms for me that when I send new coordinates via DDMS that the emulator sees the change. So why can't the browser or Maps figure out where I am? Thanks. ...Jake -- Jake Colman | Director, Software Development Principia Partners LLC 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770 t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929 e: col...@ppllc.com | w: www.principiapartners.com Credit technology innovation awards winner 2008 and 2009 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Emulator Unable to Access Location
MM == Mark Murphy mmur...@commonsware.com writes: MM Jake Colman wrote: I'm sure that I'm doing something obviously wrong but I cannot figure it out. I am using a Android 1.6 emulator with the Google API. No matter what I try the emulator cannot determine its location. Both the browser and the Maps application both say that the location is unavailable. The emulator is configured with GPS. I used DDMS to send GPS coordinates. I wrote a small GPS application that displays the current location whenever the location changes. The application confirms for me that when I send new coordinates via DDMS that the emulator sees the change. So why can't the browser or Maps figure out where I am? MM You did not indicate the order in which you tried things. You MM need to open the browser or Maps, then send the fix, not the MM other way around. Mark, I started my application running in the emulator, went back to Home, and started the Browser. The Browser displayed Location unavailable. I entered coordinates into DDMS, pressed 'send', and tried to update location. I still get Location unavailable. ...Jake -- Jake Colman | Director, Software Development Principia Partners LLC 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770 t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929 e: col...@ppllc.com | w: www.principiapartners.com Credit technology innovation awards winner 2008 and 2009 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: Emulator Unable to Access Location
MM == Mark Murphy mmur...@commonsware.com writes: MM Jake Colman wrote: I started my application running in the emulator, went back to Home, and started the Browser. The Browser displayed Location unavailable. I entered coordinates into DDMS, pressed 'send', and tried to update location. I still get Location unavailable. MM My guess is that is a limitation in the Browser app on the MM emulator, at least on Android 2.2. The Maps application works as MM I would expect -- open the application, get a map of the world, MM push a fix from DDMS, and My Location pops up. My emulator is running Android 1.6. And the Maps appplication is ignoring the fix. :-( Any suggestions of how I go about fixing this? -- Jake Colman | Director, Software Development Principia Partners LLC 101 West Elm Street | Conshohocken | PA 19428 | +1 (610) 755 9770 t: +1 (610) 755 9786 | c: +1 (610) 348 2788 | f: +1 (201) 221 8929 e: col...@ppllc.com | w: www.principiapartners.com Credit technology innovation awards winner 2008 and 2009 -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en