package com.unionassets.android.plugin.preview;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.unionassets.android.plugin.preview.UnityPlayerActivity;
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals("android.intent.action.BOOT_COMPLETED")) {// 전달된 값이 '부팅완료' 인 경우에만 동작
Intent i = new Intent(context, UnityPlayerActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
}
BootReceiver.java
<!-- 부팅을 확인 할수 있는 퍼미션 등록 -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="false"
android:label="BOOTReceiver">
<intent-filter >
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
AndroidManifest.xml
유니티에서 export한 프로젝트를 안드로이드에서 앱 자동실행기능을 추가하려고 합니다.
기기와 같은 롤리팝 버전으로 맞췄고 애뮬레이터에서는 부팅 시 자동으로 앱이 실행되는데
기기와 연결했을 시에는 자동으로 실행이 안됩니다.(휴대폰이 아닌 디지털사이니지입니다)
오류가 뜨거나 앱이 종료되거나 하진 않아서 더욱 막막한 상황입니다.
제발 도와주시길 부탁드립니다 ㅠㅠ