简体   繁体   English

我是否能够在第一次运行应用程序时使用android服务器

[英]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.

相关问题 我无法在Android应用程序中使用RestApi - I am not able to use RestApi in android application 如何将我的安卓手机用作蓝牙耳机? - How am I able to use my android phone as bluetooth headset? 我无法完成/关闭我的申请 - I am not able to finish/close my application 为什么我无法在 android 中运行我的 flutter 项目,不断出现 gradle 错误? - why i am not able to run my flutter project in android constantly getting gradle error? 由于android studio和adb.exe的更新,我无法运行我的程序 - I am not able to run my program due to update of android studio and adb.exe 我无法使用内容提供商在android应用程序中更新我的电子邮件 - I am not able to update my email in android application using content provider 我的 android 工作室中的播放按钮被禁用,我无法在 android 工作室上运行代码 - The play button in my android studio is disabled and I am not able to run the code on android studio 我第一次使用react-native run-android时遇到了困难。错误如下所示 - I am having a difficulty with first time react-native run-android. The Error looks like this following 在我的 android 工作室中,我无法附加调试器 - In my android studio I am not able to attach my debugger 我无法在移动(android)REACT NATIVE 中运行应用程序 - I am not able to run app in mobile (android) REACT NATIVE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM