说一下我的看法
1.<category android:name="android.intent.category.HOME" />在清单文件中的receive上加上这句话
2.将你的程序置为/system/app/下
3.安装完成之后首先启动一次应用程序之前也碰到过这种情况,网上都说这是3.0以后的限制,只有系统级别的应用才可以收到开机广播,所以只能把程序放到/system/app下,然后一切ok
1.<category android:name="android.intent.category.HOME" />在清单文件中的receive上加上这句话
2.将你的程序置为/system/app/下
3.安装完成之后首先启动一次应用程序之前也碰到过这种情况,网上都说这是3.0以后的限制,只有系统级别的应用才可以收到开机广播,所以只能把程序放到/system/app下,然后一切ok
楼主看我的博客,我这里有记录:
http://blog.csdn.net/whu_zhangmin/article/details/18654031
另外,请教u010457784:如何将app装在/System/app/下面?
请教依然绿茶:如何获得系统权限?
1、要么你是手机厂商,那么eng版本直接adb push到/system/app目录下。
2、三方应用的话,需要root手机,可以安装一个百度一键root或者360root,root之后,先将apk拷贝到sd
adb shell
su
cp -fr 源apk地址 /system/app获得系统权限:
厂商就不说了
上面说的手机root
要不然除非有手机系统的签名,不然没辙
http://blog.csdn.net/fangzhibin4712/article/details/38316723
本人也被困扰了,但是对ndk实在不在行,大家看看这篇文章,如果搞定了,麻烦点播一下,好造福群众,小弟谢过了
有一个解决办法,不一定都适用,反正我的问题解决了。。<category android:name="android.intent.category.HOME" />
receiver的intent-filter用这个
1.安装应用后,首先要启动一次。
2.如果签名后,不可以用eclipse安装apk文件,手动安装好后,也要启动一次。
3.添加以下:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.RESTART_PACKAGES" />
4.添加以下:
<receiver android:name=".BootBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.HOME" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" /> <data android:scheme="package" />
</intent-filter>
</receiver>5.代码部分:
public class BootBroadcastReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
//接收广播:系统启动完成后运行程序
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED))
{
Intent ootStartIntent = new Intent(context, Login_Activity.class);
ootStartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(ootStartIntent);
}
//接收广播:安装更新后,自动启动自己。
if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED) || intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED))
{
Intent ootStartIntent = new Intent(context, Login_Activity.class);
ootStartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(ootStartIntent);
}
}
}总结一下,以上功能,开机自动启动,更新后,也会自己启动自己。
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.net.wifi.WIFI_STATE_CHANGED"></action>
</intent-filter> 我这么写有问题吗,我现在总是接收不到啊,真着急