且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

已安装我的应用程序时,Android的意图

更新时间:2022-12-30 09:00:28

有可能让你没有可靠的事件。即使 TIMER_TICK 将只以下的Andr​​oid 3.1。 3.1。以后您不能接收系统广播,直到您的应用程序处于活动状态的(即用户必须至少一次手动启动它)的。

There is no reliable event that you can catch. Even TIMER_TICK will only work below Android 3.1. From 3.1. onwards you can't receive system broadcasts until your app is in active state (which means the user has to launch it at least once manually).

上停止应用程序启动控制

从安卓3.1开始,系统的软件包管理器会跟踪   是处于停止状态,并提供一种手段应用   控制自己的发布仪式,由后台进程等   应用程序。

Starting from Android 3.1, the system's package manager keeps track of applications that are in a stopped state and provides a means of controlling their launch from background processes and other applications.

[...]

需要注意的是该系统增加了 FLAG_EXCLUDE_STOPPED_PACKAGES 所有   广播意图。它这样做是从后台prevent广播   从无意或不必要的启动组件服务   stoppped应用程序。   [..]

Note that the system adds FLAG_EXCLUDE_STOPPED_PACKAGES to all broadcast intents. It does this to prevent broadcasts from background services from inadvertently or unnecessarily launching components of stoppped applications. [..]

应用程序处于停止状态的第一次安装的时候,他们却   尚未推出,然后当他们由用户手动停止   (在管理应用程序)。

Applications are in a stopped state when they are first installed but are not yet launched and when they are manually stopped by the user (in Manage Applications).

从href="http://developer.android.com/sdk/android-3.1.html" rel="nofollow"> 3.1

我建议当用户启动您的应用程序在第一次做你的初使工作。

I recommend to do your intitial work when the user starts your app for the first time.