新手写了个BroadcastReceiver在BOOT_COMPLETED时启动一个Service,没有Activity,请问我怎么进行调试? 自己把log写入到文件中,注意文件别存在sd卡里面,BOOT_COMPLETED时,sd有时会没有加载完成不能写入的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我现在把BroadcastReceiver中BOOT_COMPLETED改成TIME_TICK,想先让我看到Service启动起来,怎么让程序跑起来啊?按Run绿三角图标没用啊 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.filegee.second"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <application android:allowBackup="true" android:label="@string/app_name" android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme"> <receiver android:name=".LaunchReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter> </receiver> <service android:name=".BGService" android:exported="false"></service> </application></manifest> @Override public void onReceive(Context context, Intent intent) { Intent intent1 = new Intent(context , BGService.class); // 启动指定Server context.startService(intent1); } 你加个Activity再调试呗,apk不运行激活一次开机是不会自启动的 Quote: 引用 5 楼 xinyi 的回复:[code=java] @Override public void onReceive(Context context, Intent intent) { Intent intent1 = new Intent(context , BGService.class); // 启动指定Server context.startService(intent1); }不知道跑没跑起来?关机开机就跑起来了啊。可以看看DDMS有没有你的进程,也可以在收到广播或者service启动的地方加log打印。“BOOT_COMPLETE”发出来的时候也会有系统log。 抓一下log不就都清楚了http://blog.csdn.net/tiantang198707/article/details/9145071 android通过无线网络定位的问题(难道又是中国特色?) 做wap开发时,wml语言中 table不能用 android中绘图闪烁的问题 求高手写个小程序 闹钟服务的广播代码直到我打开屏幕时才执行。 关于类和对象的问题,请高手指教 ■★Android流行的浏览器的区别■★ AVD2.3.3模拟器启动不了 工程运行正常,模拟机出问题,新手求救。。。 一个APP能启动另一个APP么? 要是图片在ImageView中与View的宽一样,图片比例不变该怎么办? xml文件有误
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.filegee.second"> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <application android:allowBackup="true" android:label="@string/app_name"
android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme">
<receiver android:name=".LaunchReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver> <service android:name=".BGService" android:exported="false"></service>
</application></manifest>
@Override
public void onReceive(Context context, Intent intent) {
Intent intent1 = new Intent(context , BGService.class);
// 启动指定Server
context.startService(intent1);
}
http://blog.csdn.net/tiantang198707/article/details/9145071