*sigh* That solution you were given is utterly broken -- the restriction placed on the context is to HELP people from doing stuff that is not actually going to work all of the time (since your hosting process can be killed any time after onReceive() returns, before onBind() comes back). So this person is deliberately being tricky to work around the help the system is providing to not do something broken, so they can do something broken.
ARRRRGHHHH. Could you please tell this person to stop this? And I'll probably modify the platform in the future to also impose this restriction on the other context, to keep people from making this mistake. Hopefully it doesn't break too many apps. :p On Fri, Jul 10, 2009 at 3:16 AM, nuno <[email protected]> wrote: > > Thanks Dianne, > > I tried a solution from John on the TTS group which worked well but I > soon realised that trying to the stuff I need on the BR is just a lot > more work and stupid :) > I am now writing a big post-it on my screen with: "Broadcast Receivers > are only to receive events and kick start services and activities > where you do the stuff you want to do - NOTHING ELSE" :) > > Thanks again. > > Nuno > > (For other users: John's solution is:) > quote: > "Hi again, > sorted it! > you need to create a new context object from the TTS package context, > like so - > Context myContext = ctx.createPackageContext("com.google.tts", 0); > where ctx is the context from your BroadcastReceiver. Now use > myContext in your TTS constructor. > John > " > > > On Jul 9, 6:28 pm, Dianne Hackborn <[email protected]> wrote: > > You need to start your own service and do the work there. There are > > examples of this in APiDemos. > > > > On Thu, Jul 9, 2009 at 3:18 AM, nuno <[email protected]> wrote: > > > > > Hi all, > > > I am trying to start TTS from a broadcast receiver and it as document > > > an intent receiver can't bind the service. > > > Is there a work around, I can't figure out how to start the service > > > using startService(Intent, Bundle) any tips? > > > Thanks, > > > > -- > > Dianne Hackborn > > Android framework engineer > > [email protected] > > > > Note: please don't send private questions to me, as I don't have time to > > provide private support, and so won't reply to such e-mails. All such > > questions should be posted on public forums, where I and others can see > and > > answer them. > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

