I can not understand how the application autorun works here is my code

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.example.loginpage"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.QUICKBOOT_POWERON" /> <application android:name="com.example.loginpage.app.AppController" android:allowBackup="true" android:icon="@mipmap/tobo_icon" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".login"> <intent-filter> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".loading"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Main" android:label="@string/title_activity_main" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name="com.example.loginpage.MyBroadcastReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.QUICKBOOT_POWERON" /> <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" /> </intent-filter> </receiver> </application> </manifest 

everything seems to be right here, but what to do with this

 import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class MyBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent startServiceIntent = new Intent(context, Main.class); context.startService(startServiceIntent); Log.d("Cre","working"); } 

everything seems to be correct, but still not working

    1 answer 1

    You have placed the provider ad inside the activation tag. It is not right. The provider must be declared inside the application tag.

    • one
      Thanks, everything works - Sergey
    • and how to make this application open in the background when autorun occurs? When I start, I see it in open applications and can close it, how to make it impossible to see it @ YuriySPb - Sergey
    • one
      @Sergey, try asking a separate question. Personally, I don’t know the answer, and I even doubt that this is possible without any manipulations with device rutting and other hacks - YuriySPb
    • Maybe I put it wrong, for example, the VKontakte application starts to work as soon as the phone turns on, and sends you alerts even if you haven’t and you don’t see it running @ YuriySPb - Sergey
    • can you please look at this question can you know the answer ru.stackoverflow.com/questions/654824/… - Sergey