Mc Flurry Posted May 3, 2011 Share Posted May 3, 2011 Bonjour, Je test actuellement le système de service qui a l'air bien pratique. Après avoir codé les méthodes de surcharges de la classe Service, ajouté mon service au manifest, lorsque dans mon activity principale (qui fonctionne sans service) je lance mon service, une erreur apparait et bloque mon application. LogCat : 05-03 12:44:18.081: WARN/ActivityManager(68): Unable to start service Intent { cmp=com.application.background.service/.BackgroundService }: not found Voici la partie de code Java de mon activity principale intent = new Intent(); intent.setClassName("com.application.background.service", ".BackgroundService"); ServiceConnection remoteConnection = new ServiceConnection() { public void onServiceDisconnected(ComponentName name) { } public void onServiceConnected(ComponentName name, IBinder service) { IRemoteBackgroundService service1 = IRemoteBackgroundService.Stub .asInterface(service); try { service1.getPid(); service1.getData(); Log.d(TAG, "service dans onServiceConnected().........................."); } catch (RemoteException e) { e.printStackTrace(); } } }; bindService(intent, remoteConnection, Context.BIND_AUTO_CREATE); try { Thread.sleep(1000000); } catch (InterruptedException e) { e.printStackTrace(); } unbindService(remoteConnection); et mon manifest : <application android:icon="@drawable/icon" android:label="@string/app_name"> <service android:name="com.application.background.service.BackgroundService" android:process=":remote" /> </application> L'architecutre de mon projet est de ce type : + src + com.application.activity - ActivityPrincipale.java [... ] + com.application.background.bo - Data.java [Objet parcelable que je ferai transiter entre l'activity et le service] - Data.aidl + com.application.background.service - BackgroundService.java - BackgroundServiceBinder.java - IRemoteBackgroundService.aidl Merci de votre aide. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.