안녕하세요.
Acitivity 를 어떤 특수한 조건에서는 화면에 띄우지 않고
백그라운드로 실행시키고 싶은데 방법이 있나요.
폰을 Power On 해서 boot가 끝났을때 자동으로 서비스를 올리려고 합니다.
서비스를 반드시 Activity에서 bind 해야하는 구조라서 Activity 를 반드시 유저가 못보겠금 실행을 시켜야합니다.
여기 관련된 지식이나 해결하신분 계시면 답좀 주시면 감사하겠습니다.
현재까지는 아래와 같이 리시버를 등록해서 폰이 부트가 끝나면 자동으로 Main Activity를 Intent 시키는 부분입니다.
Flag를 백그라운드로 주는 것은 없어서.. 강제로 finish() 를 해서 죽이고는 있지만, 역시 유저에게 살짝보였다 사라지네요..
도움 주시면 감사하겠습니다.
감사합니다.
public class BTOneKeyBootupStart extends BroadcastReceiver{
Context mContext;
@Override
public void onReceive(Context context, Intent intent) {
mContext = context;
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
Log.e("BTOneKeyBootupStart", "++++++++++ BTOneKeyBootupStart!!!!!!! ++++++++++");
Intent i = new Intent(BTOneKeyBootupStart.this.mContext, BTOneKeyActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Bundle bun = new Bundle();
bun.putString("bootup", "1");
i.putExtras(bun);
BTOneKeyBootupStart.this.mContext.startActivity(i);
}
}, 1000);
}
}