android开机启动service 适合闹钟程序
2010-09-15 00:07:00 来源:WEB开发网84. {
85. public void run()
86. {
87. log();
88.
89. hd1.postDelayed(mTasks, delay);
90. }
91. };
92. }
复制代码
showActivity 类:(次类中啥都没有,就是演示一下activity可以被启动)
1. package radar.com;
2.
3. import radar.com.R;
4. import android.app.Activity;
5. import android.os.Bundle;
6. import android.view.Window;
7. import android.view.WindowManager;
8.
9. public class showActivity extends Activity{
10. @Override
11. public void onCreate(Bundle savedInstanceState) {
12. super.onCreate(savedInstanceState);
13. this.requestWindowFeature(Window.FEATURE_NO_TITLE);
14. getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
15. WindowManager.LayoutParams.FLAG_FULLSCREEN);
16. setContentView(R.layout.main);
17. }
18. }
复制代码
下面是很重要的AndroidManifest
1. < ?xml version="1.0" encoding="utf-8"?>
2. < manifest xmlns:android="http://schemas.android.com/apk/res/android"
3. package="radar.com"
4. android:versionCode="1"
5. android:versionName="1.0">
6. < application
7. android:icon="@drawable/icon"
8. android:label="@string/app_name">
9. < service
10. android:name=".ServiceTest"
11. android:label="@string/app_name">
12. < intent-filter>
13. < action android:name="android.intent.action.MAIN" />
14. < category android:name="android.intent.category.LAUNCHER" />
15. < /intent-filter>
16. < /service>
17.
18. < receiver android:name=".yourReceiver" >
更多精彩
赞助商链接