Commit 1040d40c by Kim Jinsung

端末の電源ONの時の自動アプリ起動できない問題対応

parent 5a707ad7
...@@ -5,6 +5,7 @@ import android.content.Context; ...@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import jp.odakyu.toiletsignage.activity.MainActivity; import jp.odakyu.toiletsignage.activity.MainActivity;
import jp.odakyu.toiletsignage.log.Logger;
/** /**
* 端末の電源がONしたときに自動的にアプリを起動させるレシーバー * 端末の電源がONしたときに自動的にアプリを起動させるレシーバー
...@@ -12,14 +13,12 @@ import jp.odakyu.toiletsignage.activity.MainActivity; ...@@ -12,14 +13,12 @@ import jp.odakyu.toiletsignage.activity.MainActivity;
*/ */
public class OnBootReceiver extends BroadcastReceiver { public class OnBootReceiver extends BroadcastReceiver {
public static final String TAG = "OnBootReceiver";
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { Logger.i(TAG, "Power ON");
if (intent != null) {
Intent i = new Intent(context, MainActivity.class); Intent i = new Intent(context, MainActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i); context.startActivity(i);
} }
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment