[android-developers] MediaPlayer failures on Android 2.1?
Hi there! I developed an audioplayer for Android for our new project which plays local and online files. It works great on the G1, but somehow often fails on the Nexus One when streaming MP3s from the Internet - especially smaller files. The problem is that I am using the prepareAsync() method and an OnPreparedListener but somehow onPrepared() is not called sometimes - especially when the network is slow. So I am creating a MediaPlayer object, set the OnPreparedListener, call setDataSource() with an URL in it and call prepareAsync() - but onPrepared() is not called, leaving the MediaPlayer in the completely useless transient state "Preparing". And there seems to be no way to catch this failure. This is the code I used to track down this error: --- file: TestMediaPlayer.java --- package de.marcreichelt.android.testmediaplayer; import android.app.Activity; import android.media.MediaPlayer; import android.media.MediaPlayer.OnPreparedListener; import android.os.Bundle; import android.util.Log; public class TestMediaPlayer extends Activity implements OnPreparedListener { private static final String TAG = TestMediaPlayer.class.getSimpleName(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MediaPlayer mp = new MediaPlayer(); mp.setOnPreparedListener(this); try { // Music from World of Goo Soundtrack // see http://kylegabler.com/WorldOfGooSoundtrack/ :-) Log.d(TAG, "mp.setDataSource()"); mp.setDataSource("http://marcreichelt.de/misc/android/test.mp3";); Log.d(TAG, "mp.prepareAsync()"); mp.prepareAsync(); } catch (Exception e) { Log.e(TAG, "", e); } } @Override public void onPrepared(MediaPlayer mp) { Log.d(TAG, "mp.start()"); mp.start(); } } --- end of file --- To test this code I created a new AVD with Google 7 API / Android 2.1 and set the Emulator speed to "GPRS" (important!). I use the Android 1.6 SDK for compiling my project and minSdkVersion is 4. This is what I get in Logcat: 03-15 20:31:21.354: INFO/ActivityManager(63): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x1020 cmp=de.marcreichelt.android.testmediaplayer/.TestMediaPlayer bnds=[125,446][235,564] } 03-15 20:31:21.424: DEBUG/TestMediaPlayer(213): mp.setDataSource() 03-15 20:31:21.563: DEBUG/TestMediaPlayer(213): mp.prepareAsync() 03-15 20:31:21.839: INFO/ActivityManager(63): Displayed activity de.marcreichelt.android.testmediaplayer/.TestMediaPlayer: 440 ms (total 440 ms) 03-15 20:31:21.946: INFO/PlayerDriver(31): buffering (1) The method onPrepared() is not called, so I am not able to call start() on the MediaPlayer object. Can anyone confirm this problem? Is this a bug in the Android 2.1 SDK (or maybe 2.0.1, too)? And what can I do to solve this? Thanks in advance & regards Marc Reichelt || http://www.marcreichelt.de/ -- 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: MediaPlayer failures on Android 2.1?
No idea, anyone? This problem really is severe - if I can't fix this all new devices like Nexus One, HTC Desire, Motorola Milestone etc. will be affected... :-( Regards Marc Reichelt || http://www.marcreichelt.de/ On 15 Mrz., 20:55, Marc Reichelt wrote: > Hi there! > > I developed an audioplayer for Android for our new project which plays > local and online files. It works great on the G1, but somehow often > fails on the Nexus One when streaming MP3s from the Internet - > especially smaller files. > > The problem is that I am using the prepareAsync() method and an > OnPreparedListener but somehow onPrepared() is not called sometimes - > especially when the network is slow. So I am creating a MediaPlayer > object, set the OnPreparedListener, call setDataSource() with an URL > in it and call prepareAsync() - but onPrepared() is not called, > leaving the MediaPlayer in the completely useless transient state > "Preparing". And there seems to be no way to catch this failure. > > This is the code I used to track down this error: > > --- file: TestMediaPlayer.java --- > package de.marcreichelt.android.testmediaplayer; > > import android.app.Activity; > import android.media.MediaPlayer; > import android.media.MediaPlayer.OnPreparedListener; > import android.os.Bundle; > import android.util.Log; > > public class TestMediaPlayer extends Activity implements > OnPreparedListener { > > private static final String TAG = > TestMediaPlayer.class.getSimpleName(); > > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > MediaPlayer mp = new MediaPlayer(); > mp.setOnPreparedListener(this); > > try { > > // Music from World of Goo Soundtrack > // seehttp://kylegabler.com/WorldOfGooSoundtrack/:-) > > Log.d(TAG, "mp.setDataSource()"); > > mp.setDataSource("http://marcreichelt.de/misc/android/test.mp3";); > Log.d(TAG, "mp.prepareAsync()"); > mp.prepareAsync(); > > } catch (Exception e) { > Log.e(TAG, "", e); > } > > } > > @Override > public void onPrepared(MediaPlayer mp) { > Log.d(TAG, "mp.start()"); > mp.start(); > } > > } > > --- end of file --- > > To test this code I created a new AVD with Google 7 API / Android 2.1 > and set the Emulator speed to "GPRS" (important!). I use the Android > 1.6 SDK for compiling my project and minSdkVersion is 4. > > This is what I get in Logcat: > 03-15 20:31:21.354: INFO/ActivityManager(63): Starting activity: > Intent { act=android.intent.action.MAIN > cat=[android.intent.category.LAUNCHER] flg=0x1020 > cmp=de.marcreichelt.android.testmediaplayer/.TestMediaPlayer > bnds=[125,446][235,564] } > 03-15 20:31:21.424: DEBUG/TestMediaPlayer(213): mp.setDataSource() > 03-15 20:31:21.563: DEBUG/TestMediaPlayer(213): mp.prepareAsync() > 03-15 20:31:21.839: INFO/ActivityManager(63): Displayed activity > de.marcreichelt.android.testmediaplayer/.TestMediaPlayer: 440 ms > (total 440 ms) > 03-15 20:31:21.946: INFO/PlayerDriver(31): buffering (1) > > The method onPrepared() is not called, so I am not able to call > start() on the MediaPlayer object. > > Can anyone confirm this problem? Is this a bug in the Android 2.1 SDK > (or maybe 2.0.1, too)? And what can I do to solve this? > > Thanks in advance & regards > Marc Reichelt || http://www.marcreichelt.de/ -- 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: MediaPlayer failures on Android 2.1?
Hi Mark, thanks for your answer! It really is helpful. I tried to reproduce the problem by creating an MP3 file on my own, but the problem did not occur again. So I used my original testfile and filed a bug: http://code.google.com/p/android/issues/detail?id=7186 Regards Marc Reichelt || http://www.marcreichelt.de/ On 16 Mrz., 00:31, Mark Murphy wrote: > Marc Reichelt wrote: > > No idea, anyone? This problem really is severe - if I can't fix this > > all new devices like Nexus One, HTC Desire, Motorola Milestone etc. > > will be affected... :-( > > Well, I can tell you that I can replicate your problem with your test > MP3 file, even hosted from my Web server. I can replicate the problem on > the Motorola DROID (Android 2.0.1) as well. And network speed doesn't > seem to have an impact -- mine fails with a fairly snappy connection. > > OTOH, these Librivox poetry MP3 files work fine, and they are all > shorter than your test file: > > http://www.archive.org/download/song_librivox/song_donne_mac_64kb.mp3http://www.archive.org/download/sonnet_23_librivox/sonnet_23_shakespe...http://www.archive.org/download/cow_stevenson3/cow_stevenson_ol_64kb.mp3 > > So, file length is not the determining factor. In fact, I have not > gotten a failure on anything other than your test file. > > So, while there certainly is a bug -- MediaPlayer shouldn't just quietly > fail -- I do not think it is as widespread as you fear. > > If you can find a couple of legally-distributable files that exhibit the > problem, package them and a sample project up and file an issue > onhttp://b.android.com. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Android Online Training: 26-30 April 2010:http://onlc.com -- 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: -http-proxy for emulator on Android 1.6?
Hi duykham! I just tried the solution you provide on your blog (Link again just for the record): http://duykham.blogspot.com/2009/11/setting-proxy-for-android-by-gui.html But it seems this solution does not work for me, the emulator still is not able to connect. When will the -http-proxy option be finally fixed? It really is a severe problem for us here because we do not have Internet connection without it. :-( Regards Marc On 3 Nov., 09:58, duykham wrote: > Hi Marc, > > Seems -http-proxy parameter does not work with emulator. In order to > use proxy for emulator, you can follow the guideline I posted on my > blog. > > This > link:http://duykham.blogspot.com/2009/11/setting-proxy-for-android-by-gui > > Hope this help. > > P/S: It works well with all versions from 1.6 to earlier. But, not > work with Eclair (2.0), (I don't know the reason >"< ) > > On Oct 23, 7:12 pm, Marc Reichelt wrote: > > > Hi again, > > > is there anyone out there who at least has the same problem? > > > Regards > > > Marc Reichelt || http://www.marcreichelt.de/ > > > On 22 Okt., 20:54, Marc Reichelt wrote: > > > > Hi there! > > > > I am developing applications for Android in a company where the > > > Internet is accessable via aproxyserver only. > > > I found out that the emulator of the 1.5 R3 SDK works well with the > > > option -http-proxy, but the emulator of the 1.6 R1 SDK does not. Can > > > anyone confirm this behaviour? > > > > Is this a bug in the 1.6 R1 SDK? And if so, is there a chance this > > > gets fixed in - let's say - 1.6 R2? > > > > Or am I just doing something wrong, though providing the same options > > > for the 2 different emulator versions? > > > > Many thanks in advance & regards > > > > Marc Reichelt || http://www.marcreichelt.de/ -- 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] Creating mutable Bitmap directly from a File - performance?
Hi there! I am using the Canvas class to draw things onto existing images. Right now I am using the following code: ---snip--- // File is a JPG file, e.g. "example.jpg" Bitmap immutableBitmap = BitmapFactory.decodeFile(file.getAbsolutePath ()); Bitmap b = immutableBitmap.copy(Bitmap.Config.ARGB_, true); immutableBitmap = null; Canvas c = new Canvas(b); Paint p = new Paint(); // drawing starts here ---snap--- As you can see I first read a bitmap from a file, just to create a mutable copy of it in the next step. But isn't this a huge lack of performance? Wouldn't it be better to create a mutable bitmap directly? And how may I achieve this, if possible? Thanks in advance & regards Marc Reichelt || http://www.marcreichelt.de/ -- 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] High performance access on static data: What is your approach?
Hi! I am writing a program where I have to access some static data, and now I am looking for the best method of how to include them into the project. This is what I found out by now: 1. Reading in the data by parsing an XML is *slow* (even using the SAX parser). 2. Reading the data by parsing a CSV file is faster than loading an XML, but again is too slow. 3. Putting the data into a Java file directly (e.g. by defining an array) fails because Dalvik says it is too large. 4. Reading in the data using serialization is slow. The funny thing here is: It takes a bit longer than loading the XML file. 5. Reading in the data from a SQLite database is the fastest method until now. But a bad workaround is needed: A SQLite DB can not yet be read directly from the resources, but instead has to be copied to the cache or to the SD card - even for read-only access. Right now I am using method 5, but I would really like to use a more simplified and faster solution. What I found out: Unserialization in Java is *fast* (reading a HashMap with 5000 integers and strings in 79ms on my PC), while the same action on my G1 takes over 13500ms. I know that I can not compare a PC to a mobile device. But still, there seems to be a big difference here. I think that the JRE directly copies the serialized data to RAM, while Dalvik seems to read every object step by step. Is this going to change in the future? And, most interestingly: what do you do to access lots of static information? Thanks in advance & happy hacking Marc Reichelt || http://www.marcreichelt.de/ -- 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: High performance access on static data: What is your approach?
Hi Jesse, > I've filed an internal issue for us to investigate our serialization > performance problems. That would be great. The slow serialization really is a problem. Not only for me, but for many others, too. The advantage of serialization simply is that it is the most simple way of writing and reading data. Of course there are disadvantages like update inconsistency. But still there are use cases where these do not occur, like with static data or cached data that is deleteted on every update anyway. > How are you parsing the CSV? Are you buffering the input? Any > mechanism that generates many intermediate Strings will be inefficient > on a device. During my first test I used String.split(), which generates intermediate Strings. So my solution was not as optimal as possible, yet by means slower than reading all data from a SQLite database. > > 4. Reading in the data using serialization is slow. The funny thing > > here is: It takes a bit longer than loading the XML file. > > This is unfortunate, but not too unreasonable. Depending on what > parser you use, XML might need to do as much work as serialization - > reflectively inspecting types and doing proper serialization lifecycle > requires a lot of complex code. I suspect there are still many > opportunities to improve Java serialization here (caching reflected > fields?); I'll investigate. I would be very happy if the serialization (and unserialization) gets faster in the future. I know this is not easy, but many applications will profit from this. Thanks & regards Marc Reichelt || http://www.marcreichelt.de/ -- 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: High performance access on static data: What is your approach?
Hi Dianne, > If performance is your main goal, a binary data blob with your own defined > structure is a likely candidate. The current asset manager has a limit of > 1MB for reading a compressed data stream; if you are wanting to do random > access, you could store it uncompressed in the .apk and open a direct fd to > it, but then you are facing the issue of creating an overly-large .apk. > > You haven't really specified enough about what you are trying to do to be > able to offer a concrete solution. How much data are you talking about? > How do you want to access it? How often do you need it? For my current application I have two different needs: 1. Some static data (~70k binary, ~1000 objects) that has to be accessed at all time and is read in completely on startup. Currently I am storing this data in a SQLite DB in the res/raw/ folder because any other option (serialization or XML: >3000ms, CSV: >1000ms) was slower than SQLite (~500ms). Yet the SQLite file has to be copied to the cache directory in order to access it. 2. Some cached data (up to ~50k) with up to 75 objects for each data unit. The serialization of each data unit takes between 50 and 200 ms. But for me it is much easier to serialize these objects and put them into a SQLite DB as BLOB than to create a complex SQL structure for it. Nevertheless: The unserialization process takes up to 5 seconds, which is way too long. Regards Marc Reichelt || http://www.marcreichelt.de/ -- 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: High performance access on static data: What is your approach?
Hi there, I have an additional cache where images are stored on the SD card. These are loaded pretty fast. But my data right now consists of many objects with many fields. This is a totally different use case. Of course I would not use serialization for images. ;-) Regards Marc Reichelt || http://www.marcreichelt.de/ On 25 Nov., 20:21, Streets Of Boston wrote: > I use a RandomAccessFile for a thumbnail database. Works pretty fast > (i haven't done any exact benchmarking). > > On Nov 24, 3:09 am, Marc Reichelt wrote: > > > Hi! > > > I am writing a program where I have to access some static data, and > > now I am looking for the best method of how to include them into the > > project. > > > This is what I found out by now: > > > 1. Reading in the data by parsing an XML is *slow* (even using the SAX > > parser). > > 2. Reading the data by parsing a CSV file is faster than loading an > > XML, but again is too slow. > > 3. Putting the data into a Java file directly (e.g. by defining an > > array) fails because Dalvik says it is too large. > > 4. Reading in the data using serialization is slow. The funny thing > > here is: It takes a bit longer than loading the XML file. > > 5. Reading in the data from a SQLite database is the fastest method > > until now. But a bad workaround is needed: A SQLite DB can not yet be > > read directly from the resources, but instead has to be copied to the > > cache or to the SD card - even for read-only access. > > > Right now I am using method 5, but I would really like to use a more > > simplified and faster solution. > > > What I found out: Unserialization in Java is *fast* (reading a HashMap > > with 5000 integers and strings in 79ms on my PC), while the same > > action on my G1 takes over 13500ms. I know that I can not compare a PC > > to a mobile device. But still, there seems to be a big difference > > here. I think that the JRE directly copies the serialized data to RAM, > > while Dalvik seems to read every object step by step. Is this going to > > change in the future? > > > And, most interestingly: what do you do to access lots of static > > information? > > > Thanks in advance & happy hacking > > > Marc Reichelt || http://www.marcreichelt.de/ -- 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: High performance access on static data: What is your approach?
Hi Timothy, I don't know if this would help a lot. Still the unserialization of the data will take a huge amount of time. I already tested copying the whole file content to RAM, but the time needed to read the data was nearly the same. Regards Marc Reichelt || http://www.marcreichelt.de/ On 30 Nov., 15:15, Timothy F wrote: > A combination of res/raw and java.nio.channels.FileChannel.map() are > likely to give you the best performance. If you know your maximum > record size, then using get on the Buffer into a byte array, b, then > wrapping that in a new DataInputStream(new ByteArrayInputStrea(b)) > will make it easy to read. > > On Nov 27, 6:17 am, Rockthesmurf wrote: > > > I package up all my files in to a single file - rename it to mp3 and > > put it in res/raw. I then get get file descriptor/offset/size and pass > > it over JNI to C code which I can then access the files data at an > > acceptable speed. My APK is around 10MB. > > > Steve > > > On Nov 24, 8:09 am, Marc Reichelt wrote: > > > > Hi! > > > > I am writing a program where I have to access some static data, and > > > now I am looking for the best method of how to include them into the > > > project. > > > > This is what I found out by now: > > > > 1. Reading in the data by parsing an XML is *slow* (even using the SAX > > > parser). > > > 2. Reading the data by parsing a CSV file is faster than loading an > > > XML, but again is too slow. > > > 3. Putting the data into a Java file directly (e.g. by defining an > > > array) fails because Dalvik says it is too large. > > > 4. Reading in the data using serialization is slow. The funny thing > > > here is: It takes a bit longer than loading the XML file. > > > 5. Reading in the data from a SQLite database is the fastest method > > > until now. But a bad workaround is needed: A SQLite DB can not yet be > > > read directly from the resources, but instead has to be copied to the > > > cache or to the SD card - even for read-only access. > > > > Right now I am using method 5, but I would really like to use a more > > > simplified and faster solution. > > > > What I found out: Unserialization in Java is *fast* (reading a HashMap > > > with 5000 integers and strings in 79ms on my PC), while the same > > > action on my G1 takes over 13500ms. I know that I can not compare a PC > > > to a mobile device. But still, there seems to be a big difference > > > here. I think that the JRE directly copies the serialized data to RAM, > > > while Dalvik seems to read every object step by step. Is this going to > > > change in the future? > > > > And, most interestingly: what do you do to access lots of static > > > information? > > > > Thanks in advance & happy hacking > > > > Marc Reichelt || http://www.marcreichelt.de/ -- 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: High performance access on static data: What is your approach?
Hi Steve, of course the parsing of the data with C code would be much faster. But this only is a workaround and therefore is not acceptable if compatibility is important. And like with SQLite the Java data structure has to be copied into another format, which means additional work if the data structure is modified. Take, for example, the following data structure: class A { int a; double b; int[] c; B[] refs; } class B { double a; double b; String s; int i; C[] refs; } class C { /* ... */ } The data structure is really simple, but there are references. If I know create my own SQLite structure I have to create a table for every class, update references on my own (because FOREIGN KEY does not work here), handle special values like null references etc. The procedure is at least comparable to other formats. Using serialization, I just store an instance of A to a file and my complete data structure is saved. It just is much too slow in Dalvik right now. Regards Marc Reichelt || http://www.marcreichelt.de/ On 27 Nov., 12:17, Rockthesmurf wrote: > I package up all my files in to a single file - rename it to mp3 and > put it in res/raw. I then get get file descriptor/offset/size and pass > it over JNI to C code which I can then access the files data at an > acceptable speed. My APK is around 10MB. > > Steve > > On Nov 24, 8:09 am, Marc Reichelt wrote: > > > Hi! > > > I am writing a program where I have to access some static data, and > > now I am looking for the best method of how to include them into the > > project. > > > This is what I found out by now: > > > 1. Reading in the data by parsing an XML is *slow* (even using the SAX > > parser). > > 2. Reading the data by parsing a CSV file is faster than loading an > > XML, but again is too slow. > > 3. Putting the data into a Java file directly (e.g. by defining an > > array) fails because Dalvik says it is too large. > > 4. Reading in the data using serialization is slow. The funny thing > > here is: It takes a bit longer than loading the XML file. > > 5. Reading in the data from a SQLite database is the fastest method > > until now. But a bad workaround is needed: A SQLite DB can not yet be > > read directly from the resources, but instead has to be copied to the > > cache or to the SD card - even for read-only access. > > > Right now I am using method 5, but I would really like to use a more > > simplified and faster solution. > > > What I found out: Unserialization in Java is *fast* (reading a HashMap > > with 5000 integers and strings in 79ms on my PC), while the same > > action on my G1 takes over 13500ms. I know that I can not compare a PC > > to a mobile device. But still, there seems to be a big difference > > here. I think that the JRE directly copies the serialized data to RAM, > > while Dalvik seems to read every object step by step. Is this going to > > change in the future? > > > And, most interestingly: what do you do to access lots of static > > information? > > > Thanks in advance & happy hacking > > > Marc Reichelt || http://www.marcreichelt.de/ -- 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: Push technique in android
Hi Veradis, you may open a HTTP connection from your client. The server itself should not close the connection, but send data over it if available. Warning: This certainly will decrease battery power because the mobile phone will not activate power saving for WIFI etc. while the connection is still open. Regards Marc Reichelt || http://www.marcreichelt.de/ On 2 Dez., 07:59, veradis wrote: > Hi, > > I want to implement push technology from my tomcat server to my > android app. Can this be implemented. I can contact server by using > web service from app and retrieve data, but can data be send from > server to all installed running apps without apps requesting it. > > Thanks in advance > Veradis -- 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: Push technique in android
Hi veradis, of course, here you are: http://www.google.com/custom?hl=en&client=pub-6001183370374757&cof=FORID%3A1%3BGL%3A1%3BLBGC%3A336699%3BLC%3A%23ff%3BVLC%3A%23663399%3BGFNT%3A%23ff%3BGIMP%3A%23ff%3BDIV%3A%23336699%3B&domains=exampledepot.com&ie=ISO-8859-1&oe=ISO-8859-1&q=http+connection&btnG=Search&sitesearch=exampledepot.com Regards Marc Reichelt || http://www.marcreichelt.de/ On 2 Dez., 13:01, veradis wrote: > Thanks Marc Reichelt, > > can u provide me some examples for HTTP connection. > > On Dec 2, 4:07 pm, Marc Reichelt wrote: > > > Hi Veradis, > > > you may open a HTTP connection from your client. The server itself > > should not close the connection, but send data over it if available. > > Warning: This certainly will decrease battery power because the mobile > > phone will not activate power saving for WIFI etc. while the > > connection is still open. > > > Regards > > > Marc Reichelt || http://www.marcreichelt.de/ > > > On 2 Dez., 07:59, veradis wrote: > > > > Hi, > > > > I want to implement push technology from my tomcat server to my > > > android app. Can this be implemented. I can contact server by using > > > web service from app and retrieve data, but can data be send from > > > server to all installed running apps without apps requesting it. > > > > Thanks in advance > > > Veradis -- 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] Gestures and ListView (as seen in a keynote of Google I/O)
Hi there! I have seen a small scene from http://www.youtube.com/watch?v=S5aJAaGZIvk at timecode 1:23:30 - letters are recognized by being drawn on the screen. Does anybody know how this works, or where I can find an easy example? Great thanks in advance & regards Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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: Gestures and ListView (as seen in a keynote of Google I/O)
Hi again, if anyone has the same question like I had: http://android-developers.blogspot.com/2009/10/gestures-on-android-16.html answers it. Great thanks to Romain Guy! Regards Marc Reichelt || http://www.marcreichelt.de/ On 1 Okt., 15:32, Marc Reichelt wrote: > Hi there! > > I have seen a small scene fromhttp://www.youtube.com/watch?v=S5aJAaGZIvk > at timecode 1:23:30 - letters are recognized by being drawn on the > screen. Does anybody know how this works, or where I can find an easy > example? > > Great thanks in advance & regards > > Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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] What about examples and comments in the Android reference?
Hi there! I have been using the Android documentation for a few days now, and it is quite good and easy to read. Apart from that I noticed that I missed something, and now I found out what it is: Examples and comments. If you look at the PHP documentation (e.g. http://www.php.net/manual/en/function.substr.php for the PHP substr() function) you will see many syntax-highlighted examples and comments by users. Of course there are examples in the Android documentation, especially in the Dev Guide category - they just are not at the right place if one searches the reference for a specific method or functionality. What do you think about this? @Google Team: I believe this means more work, but I also believe that it would improve the reference by all means. Maybe there is a compromise: The offline reference just contains the examples and hyperlinks guide to the online documentation for those who are looking for user comments. Regards Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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 about examples and comments in the Android reference?
Thanks for the tip, Yusuf! The examples are nice! But as I said - they aren't at the right place when one searches the reference. I have not found these examples until you sent me the link. And again, if one finds a specific method in the reference he is left alone with the API reference, and he has to find examples in the Internet on his own. Anyway - I hope that the documentation will improve as the SDK does. I also think there is a way to integrate Android developers, e.g. by using a Wiki-like system. Regards Marc Reichelt || http://www.marcreichelt.de/ On 6 Okt., 23:01, "Yusuf Saib (T-Mobile USA)" wrote: > Good point. FWIW, many people find the API demos > useful:http://developer.android.com/guide/samples/ApiDemos/index.html > > Yusuf Saib > Android > ·T· · ·Mobile· stick together > The views, opinions and statements in this email are those of the > author solely in their individual capacity, and do not necessarily > represent those of T-Mobile USA, Inc. > > On Oct 6, 6:07 am, Marc Reichelt wrote: > > > Hi there! > > > I have been using the Android documentation for a few days now, and it > > is quite good and easy to read. > > Apart from that I noticed that I missed something, and now I found out > > what it is: > > Examples and comments. > > > If you look at the PHP documentation > > (e.g.http://www.php.net/manual/en/function.substr.php > > for the PHP substr() function) you will see many syntax-highlighted > > examples and comments by users. > > > Of course there are examples in the Android documentation, especially > > in the Dev Guide category - they just are not at the right place if > > one searches the reference for a specific method or functionality. > > What do you think about this? > > > @Google Team: I believe this means more work, but I also believe that > > it would improve the reference by all means. Maybe there is a > > compromise: The offline reference just contains the examples and > > hyperlinks guide to the online documentation for those who are looking > > for user comments. > > > Regards > > > Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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] Multiple screens in one activity (like home screen)
Hi there! I am working on an application where I wish to have multiple screens (each of full display size) attached to each other horizontally, and switch between them by using the finger (swipe right / swipe left). The home screen does exactly what I want, but its implementation seems to be more complex than I thought. What would be your preferred way to achieve this functionality? Is there any Layout or View that I could reuse? More generally, it should work with the 1.5 SDK, so the gesture interface is not available. :-/ Great thanks in advance Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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] Animation between 2 activities?
Hi there! I program on an application where different views are arranged horizontally, each view of screen size. The user should be able to switch between these views using his finger. I first used the ViewFlipper, which was great for simple layouts, but which is *way* too slow if the layouts of the views are more complex, because all Views are drawn. A much better method would be to place one layout per activity and switch between these activities using the slide in / slide out animations. Is something in this direction possible with Android right now? Any recommendations or best practices? Regards & great thanks in advance Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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] ViewFlipper with clickable items
Hi! I am using the ViewFlipper to switch between different views by implementing a swing (mouse down, move and release). This works great with non-clickable items, e.g. a TextView. But if the views are clickable items (such as buttons), the onTouch() method of the ViewFlipper is not called. :-( Does anyone know why this is so and how I can implement this "pseudo gesture"? I know that I could do this easily by using the 1.6 SDK and the new gesture support, but my application is limited to 1.5. Thanks in advance & regards Marc Reichelt || http://www.marcreichelt.de/ PS: I developed a simple example so that you can see what I mean. - Content of TestFlipper.java - package com.example.test; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.widget.ViewFlipper; public class TestFlipper extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ViewFlipper flipper = (ViewFlipper) findViewById (R.id.flipper); flipper.setOnTouchListener(new OnTouchListener() { private float oldX; @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: // save start X location oldX = event.getX(); return true; case MotionEvent.ACTION_UP: // get old X location where the user started the move float currentX = event.getX(); // do not consume event if it is not clear enough if (Math.abs(currentX - oldX) < 25.0f) return false; // show previous view if (oldX < currentX) { flipper.showPrevious(); return true; } // show next view if (oldX > currentX) { flipper.showNext(); return true; } } // do not consume this event by default return false; } }); } } - End - - Content of main.xml - http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > - End - --~--~-~--~~~---~--~~ 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: Animation between 2 activities?
Hi Mark, thanks for your help! By the way: I now found out why my views took so long to load. An odd combination of an Adapter and layouting led to many useless getView() calls. Now even 10 views are fast enough for the view flipper. Anyway: I think I will use your information to make the ViewFlipper fast even if devices are slow. :-) Regards Marc Reichelt || http://www.marcreichelt.de/ On 16 Okt., 13:59, Mark Murphy wrote: > Marc Reichelt wrote: > > I program on an application where different views are arranged > > horizontally, each view of screen size. The user should be able to > > switch between these views using his finger. I first used the > > ViewFlipper, which was great for simple layouts, but which is *way* > > too slow if the layouts of the views are more complex, because all > > Views are drawn. > > Step #1: Put only the first screen's worth of content into the > ViewFlipper in your layout upon creation of your activity. > > Step #2: On the first swipe/tap/gesture/whatever to a never-before-seen > "page", inflate the content, add it to the ViewFlipper, and make it the > displayed child. > > Step #3: On the second and subsequent moves to the page, just make it > the displayed child. > > > A much better method would be to place one layout per activity and > > switch between these activities using the slide in / slide out > > animations. > > Is something in this direction possible with Android right now? Any > > recommendations or best practices? > > Users control the animations between activities (Settings > Sound & > display > Animation), not developers. You are welcome to use a > swipe/tap/gesture/whatever to elect to start or finish an activity, but > the user will control whether or not there are animations between them. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > _Beginning Android_ from Apress Now Available! --~--~-~--~~~---~--~~ 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] -http-proxy for emulator on Android 1.6?
Hi there! I am developing applications for Android in a company where the Internet is accessable via a proxy server only. I found out that the emulator of the 1.5 R3 SDK works well with the option -http-proxy, but the emulator of the 1.6 R1 SDK does not. Can anyone confirm this behaviour? Is this a bug in the 1.6 R1 SDK? And if so, is there a chance this gets fixed in - let's say - 1.6 R2? Or am I just doing something wrong, though providing the same options for the 2 different emulator versions? Many thanks in advance & regards Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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: -http-proxy for emulator on Android 1.6?
Hi again, is there anyone out there who at least has the same problem? Regards Marc Reichelt || http://www.marcreichelt.de/ On 22 Okt., 20:54, Marc Reichelt wrote: > Hi there! > > I am developing applications for Android in a company where the > Internet is accessable via a proxy server only. > I found out that the emulator of the 1.5 R3 SDK works well with the > option -http-proxy, but the emulator of the 1.6 R1 SDK does not. Can > anyone confirm this behaviour? > > Is this a bug in the 1.6 R1 SDK? And if so, is there a chance this > gets fixed in - let's say - 1.6 R2? > > Or am I just doing something wrong, though providing the same options > for the 2 different emulator versions? > > Many thanks in advance & regards > > Marc Reichelt || http://www.marcreichelt.de/ --~--~-~--~~~---~--~~ 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] Your best practices: Taking photos via Intent
Hi there! Currently I am working on an application where the user should be able to take photos. Right now I am using a self-made Activity for this, but this is far from being optimal - it works on the G1, but fails on the Nexus One. Is there any way how I can call a native camera app to take the photo, and get the JPG data, e.g. via onActivityResult? But there is a catch in it: The code should work on all devices. And as far as I know, some devices bring there own camera apps. This is ok as long as all camera apps share the same API, but this does not seem to be the case. What are your best practices to solve this problem? Or do you write your own activities, too? Thanks in advance & regards Marc Reichelt || http://marcreichelt.de/ -- 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: Is the SQLiteDatabase thread-safe?
[x] You want to read the JavaDoc at http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html and search for the keyword "thread". Regards Marc On 17 Dez., 07:20, Agus wrote: > Is the SQLiteDatabase thread-safe? -- 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] Fullscreen (no title & no status bar) - UI bug in Android?
Hi there! I am using the fullscreen mode in my application and noticed a small, but very annoying bug. After hours of testing I tracked it down to a very simple piece of code (see below). This is how the UI looks like after running it: http://i47.tinypic.com/2jfac6v.png The problem: As soon as the button is selected, a header in the size of the status bar will appear and all views will be scrolled down by the appropriate height. My code looks like this: -snip- package com.example.android.test; import android.app.Activity; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.LinearLayout; public class FullscreenTest extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // set background color to white to see what is going on getWindow().setBackgroundDrawableResource(android.R.color.white); // hide title and status bar getWindow().requestFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); // create a simple layout with a button LinearLayout contentView = new LinearLayout(this); Button button = new Button(this); button.setText("Look above! WTF?"); contentView.addView(button); setContentView(contentView); } } -snap- The problem does not occur if the status bar or the title bar is shown. As far as I tested, all SDK versions 1.5, 1.6 and 2.0.1 are affected. Can anyone verify this problem? Is this fixed in feature versions of the Android SDK (e.g. 2.1)? Thanks in advance & regards Marc Reichelt || http://www.marcreichelt.de/ -- 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: How to increase FPS (now ~20, desired ~40-50)
Hi Andre, you should definitely read the "Designing for Performance" document from: http://developer.android.com/guide/practices/design/performance.html I think you might speed up your onDraw() method a little bit this way, though I think you might not reach more than 30 or 35 FPS. At first you should eliminate all function calls in your onDraw() method. I know this is bad code style, but it really is faster. I am drawing some bitmaps for a project here this way. Second, you should create local variables for all attributes you use more than once. Third and most importantly: Remove unnecessary code. For example, you call System.currentTimeMillis() relatively often (I think you used this code for performance measuring, but anyway). And last but not least: Android comes with a profiler. Try to use it. :-) Regards Marc Reichelt || http://www.marcreichelt.de/ On 18 Jan., 10:16, Andre wrote: > Hello to all developers! > > First I want to say that I have read many articles on this subject in > this forum and on some external resources(very helpful was Robert > Green's diary atwww.rbgrn.netandwww.droidnova.com). > > However, despite all of this I want to start topic regarding FPS, and > ask for advice from experienced game developers on Android platform. > > My main question is "How to improve FPS when draw on Canvas?" > > I have implemented simple 2D arcade game skeleton for testing purpose. > Now I have ~20 FPS and want to increase this value to 40-50 FPS, if > this is possible of course. I know about Open GL ES, but so far I am > interested in Canvas. > > In every frame I draw following stuff on the screen: > - Canvas.drawColor(Color.BLACK) - to clear the screen > - 1 spaceship PNG 24x24 image 1.25 kb > - 5 asteroids PNG 64x64 image ~8 kb each > - from 1 to 30 bullets PNG 8x8 image 299 b > - 4 30x30 Rectangles - to control objects on the screen > > After running my app, in logcat I can see following output data: > - Average FPS: 20 (Total frames drawn: 1945 in 97 seconds) > - Average onDraw: 32 ms (clear canvas: 3, draw game stuff: 26, draw > controls: 1) > - Average updatePhysics: 1 ms > > From this output I can assume, that my main problem here is "draw game > stuff" wich includes: > - draw 1 spaceship > - draw 5 asteroids > - draw from 1 to 30 bullets > > Thanks in advance > Best Regards, Andre > > P.S.: sorry for my English > > Here is my code: > > --GAME > VIEW-- > > package com.example.game.asteroids; > > import java.util.Random; > > import android.content.Context; > import android.graphics.BitmapFactory; > import android.graphics.Canvas; > import android.graphics.Color; > import android.graphics.Paint; > import android.graphics.Rect; > import android.util.Log; > import android.view.MotionEvent; > import android.view.SurfaceHolder; > import android.view.SurfaceView; > > public class GameView extends SurfaceView implements > SurfaceHolder.Callback { > private static final String TAG = "Asteroids"; > private static final float MAX_VELOCITY = 3.0f; > private static final int MAX_ASTEROIDS = 5; > private static final int MAX_BULLETS = 30; > private static final int[] ASTEROID_IMG_RES = > {R.drawable.asteroid1, R.drawable.asteroid2, > R.drawable.asteroid3, > R.drawable.asteroid4, R.drawable.asteroid5}; > //private static final Bitmap.Config BITMAP_CONFIG = > Bitmap.Config.ARGB_; > private GameLoop mGameLoop; > private GameEntity mSpaceship; > private GameEntity[] mAsteroids; > private GameEntity[] mBullets; > private int mCurrentBullet; > private boolean mRight; > private boolean mLeft; > private boolean mUp; > private boolean mFire; > private long mFireTime; > private Rect mVelocityControl; > private Paint mVelocityControlPaint; > private Rect mLeftControl; > private Paint mLeftControlPaint; > private Rect mRightControl; > private Paint mRightControlPaint; > private Rect mFireControl; > private Paint mFireControlPaint; > private Random mRandom; > > private long mStartMillis; > private int mFrameCounter; > private int mFps; > private int mOverallSeconds; > private int mOverallFrameCounter; > private long mOnDrawTimer; > private int mOnDrawCounter; > private long mDrawColorTimer; > private long mDrawStuffTimer; > private long mDrawControlsTim
[android-developers] Re: question on reading from socket in android ...
Hi Antonio, it would be much easier if you would provide a small piece of example code. Otherwise we can only guess what your problem is. Regards Marc Reichelt || http://www.marcreichelt.de/ On 18 Jan., 09:16, Antonio Si wrote: > Hi, > > I have a background thread in my android client which sends a request > to a server using a > socket and then tries to read the data back from the socket. > > The data sending part works fine, but when I try to read from the > inputStream of the socket, > I am getting a EOFException. > > Any suggestions or advice would be highly appreciated. > > Thanks very much. > > Antonio. -- 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: memory problem with image... but strange...
Hi Kofa, I guess you have a memory leak here. Please make sure that all your data is cleaned up, i.e. no hard references are left. Try to call the GC manually and see how much it cleans up. Tip: Override the finalize() method of your activity and print out a log message there to see if the activity really is cleaned up later. Regards Marc Reichelt || http://www.marcreichelt.de/ On 15 Apr., 16:51, Kofa wrote: > Hi, I have some headache with an error about the system going out of > memory. > When I run the game fo first time there's no problem, but when i quit - > with finish();- and then start the app again, it gives me an error. > > The LogCat error says: > > VM won't let us allocate 5529600 bytes > > Caused by: android.view.InflateException: Binary XML file line #14: > Error inflating class java.lang.reflect.Constructor > > Caused by: java.lang.reflect.InvocationTargetException > > Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget. > > it's strange because if I finish the activity and start it again > without exiting the app then it's everything OKbut when i finish > the app and push the button to load that activity... it crashes with > this error and come back to the main menu... please any help will help > =P. thx in advance! -- 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] HTTP Live Streaming / playing .M3U8 or .TS files on Android
Hi! Does anybody know if and how it is possible to play .M3U8 video content on Android devices? According to the documentation at http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/HTTPStreamingArchitecture/HTTPStreamingArchitecture.html#//apple_ref/doc/uid/TP40008332-CH101-SW2 the video files usually contain H264 and AAC content, and both are supported by Android - but I don't get the samples on http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/UsingHTTPLiveStreaming/UsingHTTPLiveStreaming.html#//apple_ref/doc/uid/TP40008332-CH102-DontLinkElementID_22 to run. Do you have an idea? Thanks in advance Marc Reichelt || http://www.marcreichelt.de/ -- 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] Flipping views (or: the magic behind onInterceptTouchEvent)
Hi! I want to create a new widget for Android developers which allows to use the same functionality as seen on the home screen (flipping between different screens), the calendar (flipping between days) or TweetDeck (flipping through Twitter columns). The source for the launcher is there, so I thought this might not take so long: http://android.git.kernel.org/?p=platform/packages/apps/Launcher.git;a=blob;f=src/com/android/launcher/Workspace.java;h=2e04311f530003dbd76695f46876a785164acb99;hb=HEAD#l572 It seems that the two methods onInterceptTouchEvent() and onTouchEvent() do all the things that are needed for getting the events, so I copied them to a new class and removed functionality that is for the Workspace only. You can see my work-in-progress here: http://pastebin.com/8p8GCEZK My problem now is: onInterceptTouchEvent() is always only called once with the MotionEvent.ACTION_DOWN action so I never get into the ACTION_MOVE case - where the actual fling would be initiated. I played around with the return values of onInterceptTouchEvent() (true means to steal events from children) and the return values of onTouchEvent() (true means to consume the event), but I didn't get any further. Is there some kind of magic behind onInterceptTouchEvent() or onTouchEvent() which I didn't notice? Is my problem even solveable? I hope so... :-) Thanks in advance & merry christmas Marc PS: I also asked this question on StackOverflow, but didn't get any answers yet: http://stackoverflow.com/questions/4455891/android-use-realviewswitcher-to-switch-between-views-like-the-home-screen-does -- 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] Add header/footer to ListView in XML?
Hi! Is it possible to add header or footer views to a ListView by just defining them in the layout XML code? So without having to inflate the views and call addFooterView() or addHeaderView() manually? Thanks in advance Marc Reichelt || http://www.marcreichelt.de/ -- 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] Placing focusable & clickable views in a custom expanded view in the notification bar
Hi! Has anyone tried to put Views, e.g. Buttons, into a list item of the notification bar? In my opinion this would be really helpful for actions that should be accessible in a very fast manner, like activating/deactivating WiFi or the 3G network. In fact I saw something like this implementet on the Samsung Galaxy S device, and now I am trying to achieve the same for all devices. I created a custom Notification using this guide: http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomExpandedView Placing two buttons in my own layout was easy. But here is the problem: The class RemoteViews ( http://developer.android.com/reference/android/widget/RemoteViews.html ) has a method called setOnClickPendingIntent(int viewId, PendingIntent pendingIntent), but it doesn't seem to work. The buttons are not focusable nor clickable, only the whole list item as such is clickable. And when it is clicked the PendingIntent of the notification is executed, not the PendingIntent of one of my buttons. Any suggestions? Regards Marc Reichelt || http://www.marcreichelt.de/ -- 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] In-app billing does not work - although everything has been checked
Hi! I am including In-app billing in a new Android application I am currently working on. The project is nearly finished and it should go live as soon as in-app billing goes live. In this project I want that users can donate to support the application. However, I can not get In-app billing to work, although I think I did everything right. Every time it is showing me that the product is unavailable. Here is the logcat shortly after clicking the button to purchase the item (product ID "donate_1") and after closing the Android Market dialog: 03-26 12:07:42.440: DEBUG/More(12297): buying: donate_1 03-26 12:07:42.440: DEBUG/BillingService(12297): RequestPurchase 03-26 12:07:42.450: DEBUG/BillingService(12297): request id: 8723043450188864909 03-26 12:07:42.450: INFO/ActivityManager(96): Starting: Intent { act=android.intent.action.VIEW cmp=com.android.vending/.billing.InAppBuyPageActivity (has extras) } from pid -1 03-26 12:07:42.770: INFO/ActivityManager(96): Displayed com.android.vending/.billing.InAppBuyPageActivity: +313ms 03-26 12:12:28.500: INFO/BillingService(12297): handleCommand() action: com.android.vending.billing.RESPONSE_CODE 03-26 12:12:28.500: DEBUG/BillingService(12297): RequestPurchase: RESULT_ITEM_UNAVAILABLE 03-26 12:12:28.500: DEBUG/More(12297): donate_1: RESULT_ITEM_UNAVAILABLE 03-26 12:12:28.500: INFO/More(12297): purchase failed This is what I checked: 1) I correctly signed and uploaded my APK file to the developer console and saved it as draft, and I installed it on my real device. 2) I ensured that my test account, e.g. example_t...@googlemail.com, is listed as test account (the developer account is a different one, let's say example_...@googlemail.com) and is the primary account on my device. 3) The product "donate_1" (unmanaged because multiple donations should be possible) is listed as "published" and has a price of 0.79 €. 4) All static responses triggered by "android.test.purchased" etc. have been tested and work. 5) Of course the Android Market is checked to have the latest version (2.3.4). So I believe I checked all points from http://developer.android.com/guide/market/billing/billing_testing.html#billing-testing-real - and I have no idea why it still does not work. Maybe a bug? It wouldn't be the first time that <...>@googlemail.com addresses make problems, but <...>@gmail.com do not. But that is just my guess. Thanks in advance & regards Marc Reichelt || http://www.marcreichelt.de/ -- 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-app billing does not work - although everything has been checked
Hi Kostya, did you publish the In-app-items? Testing In-app payment will not work if you do not publish the In-app-items. You don't have to publish your app for testing it. In fact, you can not publish an application using In-app billing right now. My problem just is that I did everything the documentation says and still can not test it successfully. Regards Marc Reichelt || http://www.marcreichelt.de/ On 26 Mrz., 13:14, Kostya Vasilyev wrote: > I am also getting ITEM_UNAVAILABLE for my own product item with both a > test account and my developer's account. The application is uploaded but > not published, and so it the item. > > In addition, purchasing authorization for "android.test*" items under > the test account never completes. > > FWIW, the product list editing page says this: > > "An in-app product will appear UNPUBLISHED until the owning application > is PUBLISHED, at which point the in-app product's publishing state > applies. Please use the application editor to modify the application's > publishing state." > > Not sure what this means for testing. Also, the "License Test Response" > field in the profile page (where you set up test accounts) doesn't > appear to have any codes specific to in-app billing, just codes for LVL. > > -- Kostya > > 26.03.2011 14:32, Marc Reichelt пишет: > > > > > > > > > > > Hi! > > > I am including In-app billing in a new Android application I am > > currently working on. The project is nearly finished and it should go > > live as soon as in-app billing goes live. > > > In this project I want that users can donate to support the > > application. However, I can not get In-app billing to work, although I > > think I did everything right. Every time it is showing me that the > > product is unavailable. Here is the logcat shortly after clicking the > > button to purchase the item (product ID "donate_1") and after closing > > the Android Market dialog: > > 03-26 12:07:42.440: DEBUG/More(12297): buying: donate_1 > > 03-26 12:07:42.440: DEBUG/BillingService(12297): RequestPurchase > > 03-26 12:07:42.450: DEBUG/BillingService(12297): request id: > > 8723043450188864909 > > 03-26 12:07:42.450: INFO/ActivityManager(96): Starting: Intent > > { act=android.intent.action.VIEW > > cmp=com.android.vending/.billing.InAppBuyPageActivity (has extras) } > > from pid -1 > > 03-26 12:07:42.770: INFO/ActivityManager(96): Displayed > > com.android.vending/.billing.InAppBuyPageActivity: +313ms > > > > 03-26 12:12:28.500: INFO/BillingService(12297): handleCommand() > > action: com.android.vending.billing.RESPONSE_CODE > > 03-26 12:12:28.500: DEBUG/BillingService(12297): RequestPurchase: > > RESULT_ITEM_UNAVAILABLE > > 03-26 12:12:28.500: DEBUG/More(12297): donate_1: > > RESULT_ITEM_UNAVAILABLE > > 03-26 12:12:28.500: INFO/More(12297): purchase failed > > > This is what I checked: > > 1) I correctly signed and uploaded my APK file to the developer > > console and saved it as draft, and I installed it on my real device. > > 2) I ensured that my test account, e.g. example_t...@googlemail.com, > > is listed as test account (the developer account is a different one, > > let's say example_...@googlemail.com) and is the primary account on my > > device. > > 3) The product "donate_1" (unmanaged because multiple donations should > > be possible) is listed as "published" and has a price of 0.79 €. > > 4) All static responses triggered by "android.test.purchased" etc. > > have been tested and work. > > 5) Of course the Android Market is checked to have the latest version > > (2.3.4). > > > So I believe I checked all points from > >http://developer.android.com/guide/market/billing/billing_testing.htm... > > - and I have no idea why it still does not work. Maybe a bug? It > > wouldn't be the first time that<...>@googlemail.com addresses make > > problems, but<...>@gmail.com do not. But that is just my guess. > > > Thanks in advance& regards > > > Marc Reichelt || http://www.marcreichelt.de/ > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- 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-app billing does not work - although everything has been checked
Hi Kostya, of course they did charge your account for real - you _definitely_ should read the In-app documentation before doing anything else! And as I pointed out I am using a correctly signed release build, not the debug build. Still having problems. Regards Marc Reichelt || http://www.marcreichelt.de/ On 26 Mrz., 13:49, Kostya Vasilyev wrote: > 26.03.2011 15:25, Marc Reichelt пишет: > > > Hi Kostya, > > > did you publish the In-app-items? Testing In-app payment will not work > > if you do not publish the In-app-items. You don't have to publish your > > app for testing it. In fact, you can not publish an application using > > In-app billing right now. > > Ah. Good point, thanks. > > Just published my test item, and tried to purchase it from the > development phone. > > It short, it worked. > > However, even though my development phone is listed as a test account in > the Developer Console profile, I still had to enter a real credit card > number (no VISA--FAKE there), and they charged my card for real. > Good thing I set the price to $0.99. > > After I submitted the purchase, the Checkout window didn't go away for a > long time, then I got an error report in the logcat about the billing > activity having leaked a window. A couple of minutes later the > application showed that the item state changed to PURCHASED. > > Oh, I am using the actual release build, signed with a non-debug key, > same .apk as I uploaded to Market. Are you perhaps using a debug build > on your phone? > > -- Kostya > > > My problem just is that I did everything the documentation says and > > still can not test it successfully. > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- 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-app billing does not work - although everything has been checked
Hi Kostya, by the way: you can refund the payment you made from your Google Merchant account. Remember that you are testing the real system there, which means real money is going to flow if you do not refund it shortly after. Regards Marc Reichelt || http://www.marcreichelt.de/ On 26 Mrz., 13:49, Kostya Vasilyev wrote: > 26.03.2011 15:25, Marc Reichelt пишет: > > > Hi Kostya, > > > did you publish the In-app-items? Testing In-app payment will not work > > if you do not publish the In-app-items. You don't have to publish your > > app for testing it. In fact, you can not publish an application using > > In-app billing right now. > > Ah. Good point, thanks. > > Just published my test item, and tried to purchase it from the > development phone. > > It short, it worked. > > However, even though my development phone is listed as a test account in > the Developer Console profile, I still had to enter a real credit card > number (no VISA--FAKE there), and they charged my card for real. > Good thing I set the price to $0.99. > > After I submitted the purchase, the Checkout window didn't go away for a > long time, then I got an error report in the logcat about the billing > activity having leaked a window. A couple of minutes later the > application showed that the item state changed to PURCHASED. > > Oh, I am using the actual release build, signed with a non-debug key, > same .apk as I uploaded to Market. Are you perhaps using a debug build > on your phone? > > -- Kostya > > > My problem just is that I did everything the documentation says and > > still can not test it successfully. > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- 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-app billing does not work - although everything has been checked
OK, I solved it - it really was a @googlemail.com / @gmail.com problem. I entered the corresponding @gmail.com address as test account, and In- app billing started to work. It seems to be an issue at Google, so I entered a new issue here: http://code.google.com/p/marketbilling/issues/detail?id=4 I hope they will catch up and solve this problem before In-app billing goes live - although it should only affect some users (e.g. Germany). IMHO they really should stop to allow these @googlemail.com accounts. Regards Marc Reichelt || http://www.marcreichelt.de/ On 26 Mrz., 14:18, Kostya Vasilyev wrote: > 26.03.2011 15:57, Marc Reichelt пишет: > > > Hi Kostya, > > > of course they did charge your account for real > > Why the "of course"? I set this phone up as a test account in the Market > console, and "the system" knows this. > > > - you_definitely_ > > should read the In-app documentation before doing anything > > Yes, definitely plan to, when I actually start implementing it in my > app. So far I've only had time for a first, cursory read. > > Anyway, it was only $0.99, less than half the price of a pack of > cigarettes. And I can issue a refund to myself. > > > And as I pointed out I am using a correctly signed release build, not > > the debug build. Still having problems. > > Weird. From your description, we have identical setups: release builds > uploaded but not published, installed on the phone, item published in > the console, Market 2.3.4. And yet it worked for me and didn't work for you. > > -- Kostya > > > Regards > > > Marc Reichelt ||http://www.marcreichelt.de/ > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- 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] Promotional Graphic in PNG gets converted to _very lossy_ JPEG in Android Market?
Hi! I have a problem with the Android Market. I uploaded a promotional graphic (180w x 120h) as PNG. However, the Android Market seems to apply a _very_ lossy JPEG compression on it - it just looks ugly. Here is the image I uploaded to the Android Market: http://marcreichelt.de/misc/nichtlustig/before.png It gets converted to this PNG image (which basically is a JPEG image, but with .png extension): http://marcreichelt.de/misc/nichtlustig/after.png Is this a bug in the Android Market, or am I doing something wrong? I even tried to upload a JPEG image with not so high compression or as a PNG image with an optimized 256 color palette (which is even smaller than the resulting JPEG file of the market) - but he is still screwing up the image. :-/ Thanks for your help & regards Marc Reichelt || http://www.marcreichelt.de/ -- 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: Promotional Graphic in PNG gets converted to _very lossy_ JPEG in Android Market?
Hi again, by the way, the app (German language) can be viewed here: https://market.android.com/details?id=de.nichtlustig.android All other images apart from the Promotional Graphic look ok. Regards Marc Reichelt || http://www.marcreichelt.de/ On 5 Apr., 22:31, Marc Reichelt wrote: > Hi! > > I have a problem with the Android Market. I uploaded a promotional > graphic (180w x 120h) as PNG. However, the Android Market seems to > apply a _very_ lossy JPEG compression on it - it just looks ugly. > Here is the image I uploaded to the Android Market: > http://marcreichelt.de/misc/nichtlustig/before.png > It gets converted to this PNG image (which basically is a JPEG image, > but with .png extension): > http://marcreichelt.de/misc/nichtlustig/after.png > > Is this a bug in the Android Market, or am I doing something wrong? I > even tried to upload a JPEG image with not so high compression or as a > PNG image with an optimized 256 color palette (which is even smaller > than the resulting JPEG file of the market) - but he is still screwing > up the image. :-/ > > Thanks for your help & regards > > Marc Reichelt || http://www.marcreichelt.de/ -- 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