declaring a service

by Mina Shokry » Sat, 26 Sep 2009 03:50:48 GMT


Sponsored Links
 hello,

I am trying to run service example. I declare a service in a project
and want to call the service from an activity that exists in another
project.

in first project, my AndroidManifest.xml looks like this
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
     package="com.mypackage.service_server">
        <application>
                <service android:exported="true" 
android:name=".CalculatorService" /
        </application>
</manifest>

the CalculatorService class extends the Service class and its onBind
method looks like this
public IBinder onBind(Intent intent) {
        if(calculator == null) {
                calculator = new CalculatorImpl();
        }
        return calculator;
}

The CalculatorImpl class extends Calculator.Stub class and
Calculator.java is generated from Calculator.aidl.

in the other project, in the activity onCreate there is a code like
this

Intent intent = new Intent(Calculator.class.getName());
boolean connected = bindService(intent, connection, BIND_AUTO_CREATE);

the method bindService returns false. what is missing in my both
projects?

note: the Calculator.java file is shared between both projects by a
symlink.

thanks in advance.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. <WTA> Update rom cyan

kk mw nny klo mw update cyan apakah tnggal aplly aja stelah donlot dgn cm
updater sblumnya saia menggunakan cyan 4.2.5 mw gnt ke 4.2.8.1?
mhon pencerahan

-- 
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click  

2. When call mWifiManager.isWifiEnabled , it crash. thanks in advance.

Have you added the permission to read the wifi state?
Can you post the exception that is thrown?




-- 

3. Android around 2

4. glGetIntegerv() with GL11.GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES

5. When call mWifiManager.isWifiEnabled , it crash. thanks in advance.

6. Using Adapters

7. Android Framework and Kernel Develope