Problem in accessing network in IntentReceiver/onCreate

Put your problem here if it does not fit any of the other categories.

Problem in accessing network in IntentReceiver/onCreate

Postby tv_sathish » Tue Feb 26, 2008 2:18 pm

Hi Plusminus and others,
Can't we access network in IntentReceiver (how long does the Intent last?) or in onCreate() method of the Activity class? A small program that accessed a Webservice worked in normal Java project but afiled in Android project when I tried to put the piece of code within IntentReceiver (or) onCreate() method. If indeed both these approaches won't network and you can't access network within them, is there an alternative if you want to do some network activity in these places?

Plusminus, is your AndNav complete? Are you submitting it for contest, as I see u haven't shared the code?

Meanwhile, is somebody in the forum working on porting FreeTTS to Android? If somebody is trying to use FreeTTS in Android (not port it), PLEAAAAASE HELP ME. by replying....I would like to ask for an help once somebody replies regarding FreeTTS use in their project...

Regards,
TVP
tv_sathish
Developer
Developer
 
Posts: 29
Joined: Wed Jan 09, 2008 12:32 pm

Top

Postby plusminus » Tue Feb 26, 2008 6:51 pm

Hello tv_satish,

onCreate() is not made to do "heavy work".
All cpu-expensive (non gui) work should be outsourced to a thread.

About Text2Speech:
I have contact with the guy who is porting FreeTTS to Android.
http://www.l1ghtm4n.com/?q=taxonomy/term/5

As far as I know, he is going to submit it to ADC but asking for his permission, one can maybe get a preview.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Problem in accessing network in IntentReceiver/onCreate

Postby tv_sathish » Wed Feb 27, 2008 5:38 pm

Hi Plusminus,
I do understand that Activities are not supposed to do anything intensive. That's why I tried it in IntentReceiver class, but there I had problem because the Intent didn't last longer before the network call could complete. Is there an alternative to this, because I would ideally like to do the network call in the IntentReceiver?

Now since I had some problems there, I tried putting the code in Activity class onCreate method, first directly and then within the thread (run method) but believe me even that (within thread) did not work (network call was within try/catch and it went straight to the catch block where the stack trace kind of indicated that the service was unavailable, whereas running the same program in a normal Java project worked fine indeed, so what is the problem trying it in Android project?).

Can you help me by writing out a small program and testing it out? It shouldn't take you much time, but anyway bear with me for the inconvenience. May be you will also need this feature sometime. If it works for you, may be I can find out what I have done wrong.

Is your AndNav complete? Do you have plans to share the source code or atleast the APK file? Was curious to know what all goodies you have put?

Hey regarding the Text2Speech thing, do you know if FreeTTS can also be used for Speech recognition, because it does come with an implementation of JSAPI classes and it is a known fact that JSAPI is both speech recognition and synthesis(speech production) combined? That guy whose URL you have given is not even willing to share how he set up the Eclipse project to use FreeTTS? I am not trying to use his source, because as you said he is porting FreeTTS and my aim is to just try to use FreeTTS wihin Android and not porting it? Funny, but I don't understand how it will affect him if he shares how to setup FreeTTS project in Eclipse?

Can you point me to the links which describe how to port your existing projects to latest SDK? It was saying that some additional attributes are required in the Activity class specification in existing AndroidManifest.xml? What might they be?

Thanks and regards,
TVP (tv_sathish)
tv_sathish
Developer
Developer
 
Posts: 29
Joined: Wed Jan 09, 2008 12:32 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 22 guests