[android-developers] Service and START_REDELIVER_INTENT
Hi, I have been playing around with trying to restart a service that was killed while it had started. There are some questions that I can't seem to answer by searching in the API documentation. - Is the re-delivery of the Intent guaranteed? - Are there any timings available for the scheduler that re-delivers this intent? (do I wait seconds, minutes, hours, ) - Is this behaviour affected by the user (me) clicking the OK button on the forced close pop-up? (ideally it would have to work without user intervention - so no-one closing the pop-up) - Is this behaviour affected by me running the Service attached to eclipse in debug mode (i.e. I have to manually resume the debugger as it catches the exception)? - I packaged the Service with an Activity that can control it (start / stop it) .. is the strategy still supposed to work when it is only the Service that is killed and the Activity is still running? I also tried to add an UncaughtExceptionHandler, report what is happening and then package the caught Throwable in a RuntimeException and rethrow it but this way the Service is never restarted. For the other situations I get some very intermittent results and more often then not - the service is not restarted while stopSelf() is definately not called. Cheers, Lieuwe -- 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: Handler or (Local) BroadcastReceiver
We did consider that option but we decided we wanted the HTML5 without all the 'if this OS then .. else ..' stuff that comes with it. I had a quick look at how phonegap does it: For Android they inject a js object. They use the Activity.runOnUIThread(...) functionality to report back to js. For iOS the js signals the native code by loading a gap:\\ url. The Native code intercepts this and then does a js callback to receive the functionality requested. Interesting to note that it is possible here to do synchronous Android native calls but only asynchronous iOS calls. We decided on asynchronous native calls only x-platform when we designed our application. I'll have a look at the example you suggest re the broadcast receiver. Thanks. Lieuwe -- 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: Handler or (Local) BroadcastReceiver
I'll have a word with our iOS lead as it isn't my field of expertise. My understanding is that it is not possible to inject js objects with iOS. I think phonegap also uses the intercept a url 'click' method. -- 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] Handler or (Local) BroadcastReceiver
Hi, I am working on a fairly complex bit of code. I would like your input to understand which (if any at all) of the above classes I should use. The short description is that I have an Activity that displays local HTML5 within a WebView. The WebView utilises a WebViewClient which intercepts URL requests from the HTML5 implementation (I realise that on Android the HTML5/javascript implementation can directly call native code but unfortunately the HTML5 needs to be x-platform (i.e. run on iOS) so I am forced to communicate through intercepting URL's that are being loaded). The application also has a separate Thread that I use to communicate with an external server across the network. 1: When the native Android code wants to do a javascript call in the WebView object, does this need to be done via the main application thread or could for instance the external server Thread do a WebView.loadURL(javascript:..) directly? 2: Is the HTML5/javascript implementation run by the main thread? In other words, is the WebViewClient.shouldOverrideUrlLoading() called by the main application thread? 3: I implemented PUSH notifications within the application and I am currently using a BroadCastReceiver in my Activity to receive broadcast messages from the cloud messaging IntentService I added. As the Activity already contains a Broadcastreceiver - should the external server Thread (in case the answer to 1 is yes) and the WebViewClient (in case the answer to 2 is no) also send a broadcast message to report to the Activity or should I implement an additional message Handler? - on a sidenote .. I just read that I cannot perform timeconsuming actions from the BroadcastReceiver.onReceive() method. (apparently not even open pop-up dialogs although that is exactly what I do and works fine on both the simulator and a range of real devices) ... what is the solution here? Hope I explained the situation clear enough :) Cheers, Lieuwe -- 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] access points
Hi, I have some code that uses a network connection .. I create a connection by calling openConnection() on a URL object. Is there any documentation that explains how this process works? Which access point is being used? When that access point becomes invalid, will it automatically switch to another accespoint? etc. I would like to use only WIFI access points and otherwise fail even tho 3G or GPRS could be available, is that possible? Lew -- 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: access points
I understand that I can use that to monitor the network connection(s) - but I would like to choose which one to actually use when I call openConnection(). Can I tell the phone which connection I want to use (or use 2 different ones at the same time perhaps) .. or do applications only get to use the one that the OS decides is active? In my case I use a http connection as our server side API uses that - but I can go down to socket level if that is needed. -- 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: access points
Thanks for the response. It is actually a bit of a problem as I only want to use WIFI (i.e. when in a MacD or Starbucks). My app should not be allowed to use the network if it is on GPRS. I just hope the phone will prefer WIFI over GPRS if both are 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] Using contacts (again)
Is it possible to create a generic android application that uses contacts (though a contentResolver) that will run on all android versions 1.5 ? I have backward compatibility issues where f.i. my HTC Hero which is upgraded to Android 2.1 is not able to use the People.CONTENT_URI even though this is meant to be deprecated - not unsupported! If I include the new API style ContactsContract.Contacts.CONTENT_URI (with or without a check on the Build.SDK_VERSION to alternatively load the old style URI - similar to the Businesscard example - http://developer.android.com/resources/samples/BusinessCard/index.html) I would still have to set up Eclipse to use the Android 2.1 libraries. Would this application still run on an Android 1.5 device if I keep the minsdkversion in the manifest at 3? I would like to avoid having to branch my application, create 2 eclipse projects and release 2 different applications. Any advice on this? Lew -- 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 contacts
I have an issue regarding the use of contacts in my Android application. I currently do the following: Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); which allows me to pick a contact. 2 Questions: - How do I limit this to only contacts with a mobile number - Why does the intent not honour the way I have set up my contacts on the phone itself? I have set up the contacts so it will not use gmail and facebook ones, just phone ones however using the Intent I see them all Lieuwe -- 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: soft keyboard
On Jun 28, 6:35 pm, YuviDroid yuvidr...@gmail.com wrote: I found this to work for me: getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); (found here:http://stackoverflow.com/questions/1109022/how-to-close-hide-the-andr... ) That doesn't seem to do what I want. I placed the above statement after each setContentView, but if the softkeyboard is open, it will remain opened ... the only way to get rid of it is physically pushing the back button .. maybe it is possible to fake a back button event although that surely can't be the best solution -- 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] soft keyboard
Hi, I've got a problem with my application in that the soft-keyboard is not being closed unless the user pushes the back button. I use several layouts which I load using the setContentView method of the application. Some layouts contain multiple EditText fields. The soft-keyboard pops up correctly when the entry boxes are being clicked, but never gets dismissed, even after I switch to a new layout using setContentView (instigated by on-screen push buttons). I found a way of apparently removing the keyboard using the InputManager class but how exactly does that work if I don't know which entry field opened/currently owns the keyboard? Is there a way of possibly invalidating a whole layout which would perhaps cause all resources (and hopefully the keyboard) to be cleared? As said before, I currently just use setContentView to load the next screen. Cheers -- 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: Updating SDK through AVD
I know the error message doesn't seem to relate to the problem, but that fixed it for me. -C I found a direct link here: http://dl-ssl.google.com/android/repository/android-1.5_r03-linux_x86.zip Your solution may well have worked as I indeed had several of these google API's already installed (but not all the SDK's) L -- 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] SDK version problem
Hi, I have this strange problem here. I am fairly new to Android development and I was just playing around putting a few bits and pieces from several samples together. I created (in Eclipse) an Android 1.5 project (thats sdk version 3 right?) .. now it creates the apk file no problem, Eclipse doesn't indicate any problems either, but when I run this through my Android 1.5 AVD I get an error message stating ERROR: Application requires API version 4. Device API version is 3 (Android 1.5). Launch canceled! so how come it is quite capable of linking against the 1.5 library without errors, but it won't execute it in the AVD ... and more important - how do I found out which bit of code I apparently use is from API version 4?? -- 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] Updating SDK through AVD
Is there a proper fix for this Unzip failed: Cannot run program chmod: java.io.IOException: error=24, Too many open files Problem yet? I have SDK 2.0 installed, now trying to add 1.5 through the AVD and get the above warning. I tried the workarounds, running it from the commandline, forcing http instead of https but nothing works. I even tried moving the 2.0 out of the platforms directory but that doesn't help either. I can download the package, it installs to about 60% or so and then the error. Does anyone have the direct url to the SDK's so I can at least unzip / install it myself? Running this on Fedora 8 as root and ultimit is unlimited. Cheers, Lew -- 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