开发者

Android 2.2: Autostart application on boot problem

开发者 https://www.devze.com 2023-02-02 07:36 出处:网络
@Override public void onReceive(Context context, Intent intent) { Intent myIntent = new Intent(context, YourActivity.class);
@Override
public void onReceive(Context context, Intent intent) {

 Intent myIntent = new Intent(context, YourActivity.class);
 context.startActivity(myIntent);
}

I have made a class that extends BroadCastreciever. I want it to run my main class on startup, but i keep getting the "force close" message when i boot my device. I think the problem is located at "YourActivity.class".

I have tried with "TestMain.class" (my main class name) and "com.test.Testmain.Cl开发者_JAVA技巧ass". Did i miss something?

Thanks


I would follow this example if you want to start it up on boot up.

Auto Start app

0

精彩评论

暂无评论...
验证码 换一张
取 消