Các anh cho em hỏi là sao khi reboot thì nó không kích hoạt service. Anh chị nào biết chỗ nào sai thì chỉ em vs
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> </uses-permission> <uses-permission android:name="android.permission.READ_PHONE_STATE" > </uses-permission>
<application android:allowBackup="true" android:icon="@drawable/logo1" android:label="@string/app_name" android:theme="@style/AppTheme" > <service android:name=".MyForegroundService" > </service> <receiver android:name=".Autostart" > <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.intent.action.PACKAGE_REMOVED" /> <action android:name="android.intent.action.SCREEN_ON" /> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> <action android:name="android.intent.action.PHONE_STATE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="package" /> </intent-filter> </receiver>
<activity android:name=".AllAppsActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
Recive
package cylasion.data.dontplaygamesomuch;
import java.util.List;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.util.Log;
import android.widget.Toast;
public class Autostart extends BroadcastReceiver {
SharedPreferences share;
Editor editor;
@Override
public void onReceive(Context context, Intent intent) {
Intent pushIntent = new Intent(context, MyForegroundService.class); pushIntent.setAction(""); context.startService(pushIntent);
}
}
Cảm ơn các bác đã xem