by qlimax » Thu, 17 Dec 2009 21:04:04 GMT

Sponsored Links
 Hi guys.

I'm writing an application that use a service to play an audio file

I'm watching the LocalService.java and LocalServiceBinding.java
from the API DEMO

In the api demo, the LocalService.java make a notification in the
status bar, in my case it plays mp3 and make a notification. But that
doesn't matter.

My problem is that when the user press the "Back Button" the service
must stay active.
I want have the same behaviour as  when i press the "Home Button"...

Any help is welcome :D

ps:sorry for my eng



by qlimax » Thu, 17 Dec 2009 22:15:55 GMT

 sorry... maybe solved without binding
but using startService/stopService

----maybe... requires tests :::)))----


Sponsored Links


by G » Thu, 17 Dec 2009 23:03:08 GMT

 Hey I ran into this problem a while back and was pulling my hair out.
The fix is easy (and you're on the right track)

You can still call bindService, you just have to call startService
first. If the service is started via bindService, then it will live
and die with the activity that called it, but if you start it with
startService and THEN bind it with bindService, it should stay alive



by qlimax » Fri, 18 Dec 2009 00:16:43 GMT

 Hi G,
thanks a lot for the explanation.
(souch thigs should be better documented...)



Other Threads

1. Trouble with Shared Prefs.

Hey there all,

I'm having a problem that i don't know how to resolve.

I have a broadcast receiver catching a call from the system.  I need
this receiver to set a flag so that the next time my app runs it can
do something different.

I am trying to do this with a shared pref but it is not working.

In the receiver I do:

      SharedPreferences sharedPreferences =
context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
      sharedPreferences.edit().putBoolean("changed", true);

Then when i start my app I check like so:

         sharedPreferences = getSharedPreferences(PREFS_NAME,
         if (sharedPreferences.getBoolean("changed", false)){
            hasChanged = true;
            sharedPreferences.edit().putBoolean("changed", false);

This does not work.  If I download the file from the emulator after
the receiver has triggered it is empty.  It exists but there is no key
value pair.

What am I doing wrong?  Is there a better way to flag my app to run
differently on next startup?

Any help???


2. Is it possible

I have developed an android app which calls the web service which runs
smoothly on my emulator.

Will the same appl work if i installed the same application on android
mobile device and call the webservice. (server running on my laptop)

Jatin D N Patel
Masters, Computer Sci.
Suny Binghamton Univ, NY.

You Got To Think HIGH to RISE.


3. Androidpedia collaborative project...

4. Customised border for the imageView in gallery

5. SAS Workplan Resource @ NY

6. Impossible to write someting on a field

7. VERY URGENT..!! Looking For Android developer - GA