English 中文(简体)
如何开展活动,如果在背景中评估?
原标题:How to run activity, if app in background?
  • 时间:2012-05-17 10:58:58
  •  标签:
  • java
  • android

I writing the network application and i have a problem with starting activity if the application in background. I want to start activity when some data comes to network. In my Actity A a have a receiver and when it receive some answer from server, it must run the Activity B. But if the App in background, Activity B not starting and metod onCreate() doesn`t execute. It execute only when the user go back to App. But its not really what i want, becouse in Activity B i need to start timer and i neen to enable GPS and some other work. Besides that, Activity B receive some data too, and if B not existing - this receiver will never receive anything. I tryed IntentServise, but its not working - result the same as without him. Any ideas? Thanks for any information :-)

问题回答

Maybe your receiver is not getting intents when your app is background, for example if you re unregistering it in onDestroy method... try declaring your broadcast receiver in manifest. In broadcast receiver class use starActivity to call act B. This works for me.

如果你仍有一些问题,也许你应当提供一些来源法(例如,如果你打算重新工作的话),以澄清你的问题。

你们可以迫使活动退步。 您可以使用地位限制,向用户发出通知。 还想到的是,这种移动装置,人们可以在谈话中使用全球定位系统作为汽车中的导航。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签