Re: [android-developers] Where can I find the Android Cloud to Device Messaging API?

2010-05-20 Thread Michael Elsdörfer

It's part of the Google-addons:

http://code.google.com/android/c2dm/index.html


On 05/20/2010 08:53 PM, rtreffer wrote:

So Android 2.2 is out, we've got a new SDK, and a promising new
feature Android Cloud to Device Messaging.
But I just can't find any traces of this in the API diff.

Did anyone find an API? Or some further docs?

Thanks in advance,
   Rene Treffer



--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Avoid restarting http request on orientation change

2010-04-18 Thread Michael Elsdörfer
Depending on your specific needs, a service might make sense, but for
simple cases, it's not strictly necessary. You can instead use
Activity.onRetainNonConfigurationInstance(), which allows you to pass
live Java objects to the new Activity instance - i.e., for example an
AsyncTask object. Just make sure you don't create leaks by keeping
references to old instances of your Activity around.

I've been using a custom ASyncTask child class for a while that allows
me to connect to the task from a new activity instance, and have the
proper callbacks be executed even if the tasked finished in-between
activities being available:

http://github.com/miracle2k/android-autostarts/blob/master/src/com/elsdoerfer/android/autostarts/ActivityAsyncTask.java

Note that while the docs say that onRetainNonConfigurationInstance is
only for optimization, it's not quite clear what that the official
contract is. Yes, it's possible that your activity needs to restore
itself without onRetainNonConfigurationInstance(). For example, if the
user leaves your application via HOME and then goes into the Settings
and changes the device language, your activity will be stopped and
restarted, presumably without onRetainNonConfigurationInstance() being
called.

However, it might be ok if in those cases your api request will indeed
need start again fresh, depending on it's duration, and maybe whether
it changes state on the server. But for your run of the mill
orientation change, onRetainNonConfigurationInstance() is apparently
being reliable called, and it has been suggested on this list a number
of times that it is intended to be used for objects that can't be
stored in a bundle, like for example sockets.

Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] To save resources, should services use the android:process attribute?

2010-04-12 Thread Michael Elsdörfer
I have a service that runs continuously. I opted to run the service in
a separate process, communicating through IPC with the client
activities, thinking this will help conserve memory. If the user is
done interacting, Android could shut down the entire client side
process.

However, the protocol between the service and activities is actually a
bit complex, and writing all that IPC code is a bit tiresome.

Is there actually any gain here? if Android frees the memory of
finished Activities anyway, is there any benefit to using a separate
process, or is it maybe making things worse, even?

What about a stopped activity stack (i.e. the user leaving through
HOME)? If there are two processes, Android could shut down the client
side to regain memory. With a single process, would it need to choose
between either ending keeping the saved activity state in memory, or
ending the process including the service?

I can't help but notice that no other app seems to use a remote
process, including builtin one's like Google Talk or the Music Player.
I'm I correct in assuming that this is the recommended approach then?

Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using remove me as the subject.


[android-developers] Re: How to detect correctly APN changes

2010-02-10 Thread Michael Elsdörfer
Maybe try your luck with ACTION_ANY_DATA_CONNECTION_STATE_CHANGED:

http://www.google.com/codesearch/p?hl=en#uX1GffpyOZk/telephony/java/com/android/internal/telephony/TelephonyIntents.javaq=ANY_DATA_STATEsa=Ncd=2ct=rcl=64

It's not advertised in the public SDK, but Sipdroid seems to use it.

Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Are processes kept alive when nothing is being done?

2010-02-09 Thread Michael Elsdörfer
 http://developer.android.com/guide/topics/fundamentals.html#proclifeKeeping
 it around has no negative impact on the user.

It would be possible though that a broken application still has active
threads around which are eating CPU cycles, correct?

Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Animations with transparent background broken on Milestone/Droid?

2010-02-07 Thread Michael Elsdörfer
I'm using the stock android.R.anim.fade_in animation to fade in a
textview. Here's the code to reproduce:

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Animation fadeInAnim = AnimationUtils.loadAnimation(this,
android.R.anim.fade_in);
fadeInAnim.setDuration(1);

LinearLayout r = (LinearLayout)findViewById(R.id.root);
TextView text = new TextView(this);
text.setText(Hello World);
text.setTextColor(Color.BLACK);
r.addView(text);

text.startAnimation(fadeInAnim);
}

The Layout:

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent
android:id=@+id/root
android:background=#FF
/LinearLayout

This works wonderfully on the ADP1, the emulator in various versions,
but on a 2.0 Milestone, for the whole time the animation is running,
the background of the textview is visible in very light grey/blue
color.

Note that in the code above, the TextView background color is
transparent, on the activity background is set to something non-
default. If either of those are not true, the problem doesn't occur.
For example, if I set the TextView background to white also, I don't
see the artifact; same if I leave the activity background at the
default,

Is this a bug? Can other Milestone/Droid owners confirm this?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: RatingBar size issues on high-density screens (Droid, Nexus One)

2010-02-06 Thread Michael Elsdörfer
I had trouble with this too. The solution is to use support-screens to
enable anyDensity=true. Simply setting targetSdkVersion to something
= 4 also works, since this makes anyDensity=true the default.

I would have assumed that the SDK that you build against automatically
is considered the target, but apparently, this is not so. I've been
building against SDK level 5, and without explicitly setting
targetSdkVersion had the exact problem as you.

Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Managing translations updates

2009-11-28 Thread Michael Elsdörfer
I've written a simple script to convert from and to gettext .po files:

http://github.com/miracle2k/android2po

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Managing translations updates

2009-11-22 Thread Michael Elsdörfer
Once thing I've asked myself for a while now: How would one manage
continuous updates to translations? I.e., when releasing a new
version, you wouldn't want your translators having to manually copy
and paste existing translations from the previous versions, or worse,
re-translate everything. Even when for those languages that I
translate myself I noticed that when introducing a new string, I
basically need to update all the language-specific resources right
away, or I will have trouble later on trying to come up with a list of
everything that changed.

I'm familiar with gettext, where this problem is solved by basically
being able to merge the diff between Original-V1 and Original-V2 into
Translation V1.

How do people generally solve this on Android? Are there any existing
tools for the job? Maybe something that can convert to gettext and
back?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: My app runs fine on ADP1, but crashes the Motorola Droid?

2009-11-22 Thread Michael Elsdörfer
You can find a number of reports from people who see their Droids
crash in regular intervals (https://supportforums.motorola.com/thread/
16278); users like to attribute such problems to whatever app they
recently used/installed, but it really sounds like a problem with the
system in general.

Unless you receive several such problems reports, I wouldn't worry.

Michael

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] ADC II Package Rename Content Providers

2009-08-31 Thread Michael Elsdörfer

This is slightly confusing me right now. If I have a content provider, 
should it's authority be renamed also? I would have thought it makes 
sense, allowing both versions to run next to each other cleanly.

But then I seem to be experiencing strange errors if both versions do 
run hat the same time, with the non-ADC version of the app trying to use 
the ADC-Provider...or something. I can not exclude a bug in my own code, 
but I don't see where the problem is right now - both the Authority 
defined as well as the URI used to access seem to be correct and 
different in each case.

Any obvious problems I might be missing? Is using two different URIs 
generally the way to go?

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] LocationManager API too limited?

2009-08-22 Thread Michael Elsdörfer

...or maybe I am just missing something?

I have a service and would like that service to keep up with the
user's current location. I don't have any particular requirements in
terms of accuracy etc.

So I am looping over the list of all providers, and registering a
listener for each. I thought this would be preferable to just
listening to whatever getBestProvider() returns, since regardless of
state changes that may happen in the background (say the user disables
mine and enables a different provider), my service will still receive
updates.

GPS is making problems though, because it seems to *insist* on
delivering at least one location every time I registered the listener,
even though I have set both minTime and minDistance to high values. If
I'm for example currently indoors, it will keep trying forever.

I basically just want to know too when a new location becomes
available, for whatever reason that may be (possible be because some
other app is using GPS), but if not, then that's fine too.

There currently doesn't seem to be a way to do this - or is there?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Changing the More icon drawable

2009-08-01 Thread Michael Elsdörfer

Is it correct that there is no way to change the actual icon of the
automatically created more menu item? I can see there is a
android:moreIcon option for Themes, but I can't get it to work, and
it looks like the MenuBuilder class actually has the internal theme
names hardcoded.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Separating Widget from main Application

2009-07-30 Thread Michael Elsdörfer

Make sure this doesn't just happen when you launch from Eclipse - this 
is actually a pretty useful feature for development.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: onStart() not called when a service is restarted after, being killed?

2009-07-26 Thread Michael Elsdörfer

After having a look at the source code, I would think that this is
supposed to work.

See sendServiceArgsLocked (http://www.google.com/codesearch/p?
hl=ensa=Ncd=1ct=rc#uX1GffpyOZk/services/java/com/android/server/am/
ActivityManagerService.javal=8950) which are later converted to
onStart() calls in ActivityThread. handleServiceArgs (http://
www.google.com/codesearch/p?hl=ensa=Ncd=1ct=rc#uX1GffpyOZk/core/java/android/app/ActivityThread.javal=2550).

However, other people seem to have had the same experience as I, so I
assume this is not a problem with my code.

http://code.google.com/p/android-random/source/browse/trunk/TestKeepAlive/src/org/devtcg/demo/keepalive/KeepAliveService.java
(uses settings to remember whether the service was started).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Protocol Buffers (protobuf)

2009-07-25 Thread Michael Elsdörfer

I can confirm that Class.forName() works, though it's not the fastest 
thing in the world (about 3 seconds for 10 message classes). I sort of 
do feel like I need to init *all* of them in order to be safe.

Maybe I can find some clever way to do this in the background while the 
user is still busy with the UI.

Thanks!

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] onStart() not called when a service is restarted after, being killed?

2009-07-25 Thread Michael Elsdörfer

I have a service that needs to hold a persistent TCP connection, think
IM. I'm reluctant to use setForeground() - the service being down
temporarily isn't that big a deal, and I am assume I can trust that
I'll be run again once memory is available, correct?

The problem here is this. The service was started via startService()
before being killed. However, when it is restarted, only onCreate() is
executed. This makes it hard to continue, because starting work
onCreate() means I can't even bind to the service (to say query it's
status) without it doing so.

Is this a bug or per design? What is the status of the service after
it is being restarted? Is it consider started by the system, i.e.
waiting for a call to stopService()?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Protocol Buffers (protobuf)

2009-07-24 Thread Michael Elsdörfer

Ah, I've now run into this issue also, it seems. Strangely, it works 
just fine for the most part, except for random, unreproducable cases, 
where it starts to hang somewhere inside getDeclaredMethods().

  easiest way to do this is to call Class.forName(String className)
  early in the app start sequence.

Does this mean Application.onCreate()?

Michael

fadden schrieb:
 On Jul 21, 10:56 pm, fadden fad...@android.com wrote:
 The bug is that, while generating the list of declared methods, the VM
 would initialize classes found in method arguments.  Those classes
 shouldn't be getting initialized at that point, and initialization
 ordering problems ensue.
 
 I got a copy of the APK (thanks!) and poked at it.  I believe this is
 the same bug.
 
 When the app launch stalled a sent the process a kill -3 and pulled
 the stack trace out of /data/anr/traces.txt.  The two interesting
 threads are:
 
 main prio=5 tid=3 WAIT
   | group=main sCount=1 dsCount=0 s=N obj=0x4001d520 self=0xbc60
   | sysTid=1086 nice=0 sched=0/0 handle=-1343996920
   at java.lang.Class.getDeclaredMethods(Native Method)
   - waiting on 0x1a8598 (a java.lang.Class)
   at java.lang.ClassCache.getDeclaredPublicMethods(ClassCache.java:
 166)
   at java.lang.ClassCache.getDeclaredMethods(ClassCache.java:179)
   at java.lang.ClassCache.findAllMethods(ClassCache.java:249)
   at java.lang.ClassCache.getFullListOfMethods(ClassCache.java:223)
   at java.lang.ClassCache.getAllPublicMethods(ClassCache.java:204)
   at java.lang.Class.getMethod(Class.java:1006)
   at com.google.protobuf.GeneratedMessage.getMethodOrDie
 (GeneratedMessage.java:900)
   ...
 
 Graphics prio=5 tid=19 WAIT
   | group=main sCount=1 dsCount=0 s=N obj=0x43748ef8 self=0x1a4878
   | sysTid=1094 nice=0 sched=0/0 handle=1722776
   at com.ZZZ.Level$Map.clinit(Level.java:~1978)
   - waiting on 0x146768 (a java.lang.Class)
   at com.ZZZ.Level$LoadedAnnouncement.init(Level.java:-1)
   at com.ZZZ.Level$LoadedAnnouncement.clinit(Level.java:2586)
   at java.lang.Class.getDeclaredMethods(Native Method)
   at java.lang.ClassCache.getDeclaredPublicMethods(ClassCache.java:
 166)
   ...
 
 The're both under getDeclaredMethods, and they're both waiting on a
 Class object monitor (but not the same class).  The Graphics thread is
 doing a couple layers of class initialization that it shouldn't be
 doing at that point.  It's possible we've deadlocked on class init.
 
 I tried it twice and ended up in the exact same place both times.
 With the bug fix in place it started up every time.
 
 This problem will go away in a future release, but for now you can
 work around it by forcing initialization to happen earlier.  The
 easiest way to do this is to call Class.forName(String className)
 early in the app start sequence.  Start with Level$Map and Level
 $LoadedAnnouncement and see if that cures it.
 
 For anyone building their own VM, you can see the patch in
 http://code.google.com/p/android/issues/detail?id=3005 .
 
  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: In-place upgrade of app, outside of Market

2009-06-09 Thread Michael Elsdörfer

  Or the other way around: Downloaded it first from an 3rd party source
   and then trying to buy it from the Android Market... this is a more
  likely scenario. I'm not sure if the user needs to uninstall first.

No, Market seems to only care about package names. The app may appear as 
  not installed in the Market at first, but upon clicking Install, 
you'll get the usual update prompt.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Debug Appwidget using Eclipse/ADT

2009-06-07 Thread Michael Elsdörfer

It worked for me at some point, but mostly it doesn't either. However, 
you can use the Dev Tools app that is installed in the emulator to 
explicitly set your package as the one that should be debugged.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Widget developer tired of Doesn't launch comments

2009-06-04 Thread Michael Elsdörfer

  Can I hide the app
  icon from launcher after first launch?

Try PackageManager.setComponentEnabledSetting():

http://developer.android.com/reference/android/content/pm/PackageManager.html#setComponentEnabledSetting(android.content.ComponentName,%20int,%20int)

This does work for services, broadcoast receivers... so it might hide 
your launch activity as well.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Call Activity from Widget, have only one instance. I am confused.

2009-05-30 Thread Michael Elsdörfer

I've read through the Application Fundamentals three times today (and
I had done so before), but I still can't quite wrap my ahead around
the task concept. Or I guess I thought I understood it, but usually,
the results I am seeing don't match up to what I would expect to
happen (maybe a tool to see the current tasks/activities etc. for
debugging purposes would be a nice addition).

I have multiple widgets from my provider in the Launcher desktop, and
each is using a PendingIntent with a different URI as data (so they
should be separate intents) to open an Activity.

I want there to be only once concurrent instance of this Activity that
the user can access. So clicking the widget (1) , pressing HOME (2),
clicking a different widget (3), pressing BACK (4) should bring the
user back to the Desktop.

Now I did manage to do this using launchMode=singleTask - the
existing instance is brought to the top, onNewIntent() is called and I
am pretty satisfied with it.

However, supposedly there are other ways to achieve an equivalent
effect (say with having the activity restarted), and I'd like to
understand why I don't seem to be able to get them to work: In every
case, instead of seeing the home screen after step (4) (after pressing
BACK), I see the *previous* instance of the Activity.

For example, if I read this correctly:

There's another way to force activities to be removed from the stack.
If an Intent object includes the FLAG_ACTIVITY_CLEAR_TOP flag, and the
target task already has an instance of the type of activity that
should handle the intent in its stack, all activities above that
instance are cleared away so that it stands at the top of the stack
and can respond to the intent. If the launch mode of the designated
activity is standard, it too will be removed from the stack, and a
new instance will be launched to handle the incoming intent.
http://developer.android.com/guide/topics/fundamentals.html

Then simply using using the following code to start my Activity from
my widget should do what I want, no?

Intent detailIntent = new Intent(context, ViewImageActivity.class);
detailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pending = PendingIntent.getActivity(context, 0,
detailIntent, 0);

So in (3) My activity should be launched using FLAG_ACTIVITY_NEW_TASK
by the launcher, which due to process affinity would find the existing
task (which would consist of a single instance of my Activity), and
launch the new instance on top of it. This explains what I am seeing.
Why doesn't FLAG_ACTIVITY_CLEAR_TOP cause the existing instance in the
task to be replaced?

Even setting android:launchMode explicitely to standard, as
mentioned in the doc quote above, this doesn't seem to change things.

I also tried android:finishOnTaskLaunch=true, but the behaviour is
the exact same was just described with FLAG_ACTIVITY_CLEAR_TOP (which
seems to be the exact same as when doing neither and really starting
an activity without any special attributes).

I should mention that  If I click the same widget in (3) as I clicked
in (1), i.e. using the same PendingIntent twice, I do get the previous
instance brought to the front (not restarted), but again, regardless
of whether FLAG_ACTIVITY_CLEAR_TOP or finishOnTaskLaunch are being
used.

I find this especially strange since the docs about tasks don't seem
to mention the intent itself being relevant at all. Application
Fundamentals does at one point say For the default standard mode, a
new instance is created to respond to every new intent, but it's not
clear what new intent means then. Is triggering a PendingIntent
multiple times through a widget not multiple new intents then?

I also tried various combinations of the other related options, but
pretty much got nowhere.

Can anybody make sense of this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: What is the difference between thread and service?

2009-05-27 Thread Michael Elsdörfer

 From what I under understand, your application having a service running 
is basically just holding a (service) object that tells Android not to 
kill your process. The service onStart methods etc. still run in your 
main thread and are subject to Application not responding.

You could have a thread directly in your activity without using a 
service, but Android might kill your Activity/process when you're not 
looking.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Maximum size of onSaveInstanceState bundle

2009-05-27 Thread Michael Elsdörfer

I have an activity that loads a bitmap from a database when it starts 
up. Due to the nature of the app, should the activity be killed and 
recreated at a later point, I cannot guarantee that the bitmap in the 
database is still the same one.

Should I save the bitmap to the bundle to be able to ensure I am still 
having the same data available when my activity is restored? The bitmap 
may be multiple 100 kilobytes in size, and I worry that saving data this 
large would defeat the whole purpose of having my activity killed by 
Android in the first place.

Is there a fixed or recommended limit to what amount of data should be 
stored in the bundle?

Micahel

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Widget process lifetime: Why not stop the service?

2009-05-23 Thread Michael Elsdörfer

I'm writing a widget that needs to update rather infrequently (say
multiple hours). Following the source examples out there, it seems the
common solution is to use a service to prepare the updates. However,
after I am done, my process is still running on service level, it
looks like it's not being killed by Android in low memory conditions,
and killing it manually causes it to restart.

The same seems to be true for all other widgets I have installed so
far - they stay in memory.

Wouldn't it be better to have to service call this.stop() when it is
done, at least if the widget knows it probably won't need to do
another update any time soon?

I'm doing this now, and it seem to work fine - my process is being
killed when Android needs memory. I'm confused though as to why this
wouldn't be the encouraged behaviour then (it's not like the G1 has an
aweful lot of memory to spare). Should or shouldn't I be doing this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Widget process lifetime: Why not stop the service?

2009-05-23 Thread Michael Elsdörfer

  Don't use a service; use the alarm manager to schedule your
  wakeup/work.

Currently I'm actually using the widget framework's update mechanism.

 From what I understand, a service must be used in any case to avoid ANR 
when processing the request might take a bit longer.

The widget example on the developer blog uses a service as well, but 
does not call Service.stopSelf() when done.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] AppWidgets: Reusing RemoteViews instance leaks memory?

2009-05-21 Thread Michael Elsdörfer

I'm writing a widget. Currently, I'm have a simple ImageView, and
calling RemoteViews.setImageViewBitmap(). I'm using a service to do
the updates.

I thought it might be a good idea to reuse an existing RemoteViews
instance, so I'm only querying it the first time around, and
subsequently simply call setImageViewBitmap() with the new image.

This works well initially, but after some time I first start getting
!!! FAILED BINDER TRANSACTION !!! errors, and later, an OutOfMemory
exception.

Simply creating a new RemoveViews instance every time works flawlessy
on the other hand. I'm just curios why that would be, any ideas?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] AppWidgets: Dynamic value for updatePeriodMillis?

2009-05-16 Thread Michael Elsdörfer

The developer blog suggests that one might ask the user for a custom
widget update interval:

Consider updating as infrequently as possible, or letting your users
pick a custom update frequency. 
http://android-developers.blogspot.com/2009/04/introducing-home-screen-widgets-and.html

It's not quite clear to me how one would do so. The
android:updatePeriodMillis attribute is statically defined the the xml
resource, and can't be changed, no?

And related, what about minHeight and minWidth? Is it possible to let
the use choose a size during configuration? From what I understand,
the configuration dialog is only called once the widget views have
already been requested once, so I am guessing not?

Michael
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: NEW Gesture Recognition Application!

2009-04-30 Thread Michael Elsdörfer

  check out our blog and demonstration video and comment to let us know
  what you think.

I don't like having to click on a button (Call, SMS etc) after drawing 
the gesture. Instead, I'd like to see the app doing that by itself 
depending on where the gesture was defined.

Apart from that, where and when can I get it!? ;)

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Using Widget.TextView.ListSeparator

2009-04-26 Thread Michael Elsdörfer

I need to separate to content areas in my application, and I thought I
would use the OS built-in style for better integration, style-wise.
The separator used by the ListView seemed to fit.

So I had a custom style resource like this, inheriting from
Widget.TextView.ListSeparator:

style name=Header parent=@android:style/
Widget.TextView.ListSeparator.../style

And then using the resource with a view like so:

TextView style=@style/Header

Compiled a against 1.0, this worked just fine on my 1.0 device, and
also with the unofficial holiday 1.1 ADP image.

Now, using the 1.5 SDK, it still works as expected on a 1.5 AVD, but
when running the app on a 1.1 AVD or my 1.1 holiday device, the
parent style doesn't seem to be taken into account. Neither the
android:background specified by Widget.TextView.ListSeparator nor the
android:textColor value is used.

On the other hand, when targeting 1.1 in Eclipse, it*does* work in 1.1
again, but the same issue now occurs while running on 1.5.

When trying to use TextView style=@android:style/
Widget.TextView.ListSeparator directly, Eclipse says Resource is
not public , both when targeting 1.1 or 1.5.

Is there any obvious explanation for this? What would be the correct
way to reference the Widget.TextView.ListSeparator style?

Why can't I use the style directly, but are allowed to inherit from
it?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Apps labeled as Tetris Clones removed from Android Market

2009-04-13 Thread Michael Elsdörfer

  Are you unaware of the recent Scrabble issue on
  the iPhone?

You are probably referring to Scrabulous on Facebook. As far as I am 
aware, this also was mainly a trademark issue. Hasbro has claimed 
copyright on the game itself, but of course, that doesn't really mean much.

 I don't think you see my point, which is that an operating system/
 community/environment that openly disregards intellectual property
 rights is, in my humble opinion, doomed to failure from the get-go
 from the inability to form a viable business model for anyone
 involved.

I don't see this happening. However, at the very least within this 
thread, TTC's factual intellectual property rights are in dispute.

See, I think we all here believe in copyright. Some however may believe 
that copyright should expire at some point (which in fact it does). Some 
may believe that the rules of a game like Tetris should not be covered 
by copyright. Evidence I've seen so far seems to suggest that indeed 
they aren't. Laws also differ between different countries. Clearly, it's 
a judgment call how far intellectual property rights should go.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: SDKs comparison with the iPhone

2009-04-13 Thread Michael Elsdörfer

  it would be done on a discussion list, which would fit in with many
  open source projects I've worked on where pre-release versions are
  circulated and then developers say Yay or Nay to whether it's good
  enough to call a production release,

I'm not sure what Open Source projects work like that. All projects I've 
ever been involved with have some kind of circle of leadership that 
decides what is released, and when. Sometimes community input plays a 
larger role, sometimes it is smaller. I think we all agree that Android 
moving towards being more community driven is a good thing, and should 
happen rather sooner than later. But at the end of the day, there will 
always be a single instance calling the shots, and for Android, for the 
foreseeable future, that will be Google.

You really can't expect a random private build that you made to be 
considered anything other than unofficial. In pretty much any Open 
Source project I've ever heard of.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Apps labeled as Tetris Clones removed from Android Market

2009-04-07 Thread Michael Elsdörfer

  Having seen the demo video of your game I can see why they would
  appear to have a reasonable basis for their case. You'd added some
  fancy features, but the basic game play is the same right down to the
  block shapes.

I don't think so. I'm no layer either, of course, but I thought the 
consensus was that while TTC has a trademark claim to the name, 
copyright claims on features and gameplay are just bullying.

I've also never heard of TTC ever winning this case in a court, or, for 
that matter, even just following up on their threats against people who 
refuse to comply.

Michael

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] market://details not working?

2009-03-30 Thread Michael Elsdörfer

Apparently, I supposed to be able to open the Market page of my app by
querying an intent with an URL like:

market://details?id=app_id

where app_id seems to be the package name:

http://www.google.com/support/forum/p/Android+Market/thread?tid=5c8501d73226fad8hl=en

However, while this seems to indeed open the Market app with the
details activity, it always gives me A Server error occured.

I'm trying both launching the intent through code, as well as on an
adb shell as, say:

am start market://details?id=com.NamcoNetworks.PacMan

Neither works.

Any ideas?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] market://details not working?

2009-03-30 Thread Michael Elsdörfer

Apparently, I'm supposed to be able to open my app in the Android
market by querying an Intent with an URL like:

market://details?id=app_id

app_id seems to be the package name, e.g. say
com.NamcoNetworks.PacMan

See for example:
http://www.google.com/support/forum/p/Android+Market/thread?tid=5c8501d73226fad8hl=en

However, while this seems to open the Market app's detail page, it
always gives me the A server error occured message.

I've tried both using an app:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(market://details?
id=com.NamcoNetworks.PacMan));
startActivity(intent);

As well as through the adb shell:

am start market://details?id=com.NamcoNetworks.PacMan

Any ideas?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---