LocalServiceBinding.java

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

--



LocalServiceBinding.java

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


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

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




--


Sponsored Links


LocalServiceBinding.java

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
indefinitely.





--



LocalServiceBinding.java

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


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

bye.






--



Other Threads

1. Getting contact name from phone number in 1.5/1.6/2.0

Hi -- the semi-standard way of getting a contact name from a phone
number is to use Contacts.Phones.CONTENT_FILTER_URL and append the
phone number, as in the following sample code.  This works fine on
Android 1.6, but not on 2.0 -- is there a way to perform this function
that works in all versions of the Android API?


private String getContactNameFromNumber(String number) {
                // define the columns I want the query to return
                String[] projection = new String[] {
                                Contacts.Phones.DISPLAY_NAME,
                                Contacts.Phones.NUMBER };

                // encode the phone number and build the filter URI
                Uri contactUri = Uri.withAppendedPath
(Contacts.Phones.CONTENT_FILTER_URL, Uri.encode(number));

                // query time
                Cursor c = getContentResolver().query(contactUri, projection, 
null,
                                null, null);

                // if the query returns 1 or more results
                // return the first result
                if (c.moveToFirst()) {
                        String name = c.getString(c
                                        
.getColumnIndex(Contacts.Phones.DISPLAY_NAME));
                        return name;
                }

                // return the original number if no match was found
                return number;
        }

-- 

2. ListView not responding to Click or KeyPress

This is unnecessary. This problem will occur if your list item
contains focusable children (like buttons, edittexts, etc.)





> 

3. Mau bagi-bagi game UNO menjelang libur panjang

4. how to capture key events with a window-less activity

5. postBuffer and memcpy

6. How can I use org.apache.harmony.luni.platform.OSNewtorkSystem in Android SDK ?

7. Using multiple layouts for different screens.