hi,
i am facing a wierd problem. i have created a aidl service. as i have
set the notifications, it is good started and running and binding as
hsowing in notification.
However when i try to consuyme it, if i do that in the
ServiceConnection Declaration, its working fine, but if i use anywhere
else in activity it gives force close.
following is try catch code.
try {
testvar1 = mService.ServiceStatus();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Main Service Code
public class MainService extends Service {
private boolean service_status= false;
private boolean server_connection_status = false;
private NotificationManager notMgr;
public class MainServiceImpl extends IMainService.Stub {
@Override
public String ServiceStatus() throws RemoteException {
// TODO Auto-generated method stub
return "india";
}
@Override
public boolean ServerConnectionServer() throws RemoteException {
// TODO Auto-generated method stub
return MainService.this.server_connection_status;
}
}
@Override
public void onCreate() {
super.onCreate();
notMgr =
(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
displayNotificationMessage("onstart create");
}
public void onDestroy() {
super.onDestroy();
this.service_status = false;
displayNotificationMessage("onDestm create");
}
@Override
public void onStart(Intent intent, int startId) {
super.onStart(intent, startId);
this.service_status = true;
displayNotificationMessage("onstart started");
}
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
displayNotificationMessage("onBind started");
return new MainServiceImpl();
}
.......................
AIDL file
interface IMainService {
String ServiceStatus();
boolean ServerConnectionServer();
}
Please help....
Thanks
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en