1
我有一个扩展应用程序的类,它从绑定服务获取生成的ID。如何从绑定服务获取Android数据到扩展应用程序
public MyApp extends Application
{
public void onCreate()
{
super.onCreate();
Intent intent = new Intent(this, MyService.class);
bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
String id = myService.getID();
}
}
我的问题是,id
结果为空。我如何从服务中获得Id到我的应用程序类中?我假设,编译器在启动服务之前创建应用程序。
您能否将您的服务类添加到问题中? –