ACTIVITY runs automatically upon startup

Source: Internet
Author: User

------------ BootBroadcastReceiver. java
Package youbanwang. co. cc;

Import android. content. BroadcastReceiver;
Import android. content. Context;
Import android. content. Intent;

Public class BootBroadcastReceiver extends BroadcastReceiver {
Final static String ACTION =

"Android. intent. action. BOOT_COMPLETED ";


@ Override
Public void onReceive (Context arg0, Intent arg1 ){
// TODO Auto-generated method stub
If (arg1.getAction (). equals (ACTION )){
Intent splash = new Intent

(Arg0, Splash. class );
Splash. addFlags

(Intent. FLAG_ACTIVITY_NEW_TASK );
Arg0.startActivity (splash );


}
}

}

 

-------- Manifest. xml


<Activity

Android: name = "net. youmi. android. appoffers. YoumiOffersActivity"

Android: configChanges = "keyboard | keyboardHidden | orientation"/>

<Cycler android: name = ". BootBroadcastReceiver">
<Intent-filter>
<Action android: name = "android. intent. action. BOOT_COMPLETED"/>
</Intent-filter>
</Cycler>

</Application>


<Uses-permission

Android: name = "android. permission. RECEIVE_BOOT_COMPLETED"> </uses

-Permission>

 

 

From the column of gongzibai

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.