[英]am I able to use android serives in the first time I run my application
I want to get event when I use my program for the firt time so I decided to use this service 我希望在我使用我的程序的时候得到事件,所以我决定使用这项服务
public class PackageChangeReceiver extends BroadcastReceiver {
Context context;
@Override
public void onReceive(Context ctx, Intent intent) {
}}
and in the mainfest 并在主要节日
<receiver android:name=".PackageChangeReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
but this services don't work in the fist time I install my application , how can I make it run in the first time ?or it is not possible to do that ? 但是这个服务在我安装我的应用程序的第一时间不起作用,我怎么能让它在第一次运行?或者不可能这样做? I have to update the application from eclipse second time to make this service working , what is the problem. 我必须第二次从eclipse更新应用程序才能使这项服务正常工作,问题是什么。
when does android system make its services available to use , I heart onetime that I should run one of my activity to make the service available ,is it true? 什么时候android系统可以使用它的服务,我心里有一次我应该运行我的一个活动来使服务可用,这是真的吗?
Starting Android 3.1, any app that wishes to receive broadcasts must have had one of its UI components (ie an Activity) run at least once before Android sends any broadcasts to it. 启动Android 3.1,任何希望接收广播的应用必须在Android发送任何广播之前至少运行一次其UI组件(即活动)。 This is done for security reasons, to prevent malicious apps from auto launching. 这样做是出于安全原因,以防止恶意应用程序自动启动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.