with this How do I start my app on startup? post run app when devise power on success
but when devise run this show my main_activity
i want run app in background (Because i call a volley request with timer for check server in background )
my manifest.xml :
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<receiver
android:enabled="true"
android:exported="true"
android:name="other_class.CLASS_START_UP"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
my class start_up :
public class CLASS_START_UP extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
Intent i = new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
i use this post Run volley request every 5 minutes in background android to run volley request in timer
my timer code is :
private Runnable runnableCode = new Runnable() {
@Override
public void run() {
get_start_info();
// Repeat this the same runnable code block again another 2 seconds
handler.postDelayed(runnableCode, 10000);
}
};
my problem is i dont want when devise turn on show main activity show to user (foreground) i want only run in background
i am sorry i am not good in English language