我想在手机启动时启动我的应用程序
我只是按照这里的教程进行操作,但它在我的设备中不起作用。请看我的方法:
public class MyStartUpReciever extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Intent ii = new Intent();
ii.setAction("com.sat.servicetrack");
context.startService(ii);
}
}
这是我的 manifest.xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".ServiceTrack"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".MyStartupReciever">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<service android:enabled="true" android:name=".MyService" >
<intent-filter>
<action android:name="com.sat.servicetrack" />
</intent-filter>
</service>
</application>
我错过了什么吗?