0
"Call"앱으로 작업하고 있습니다.Wake Lock이 안드로이드 롤리팝 (API 21) 5.0.2에서 작동하지 않습니다.
API 21에서 'wake lock'을 해제하는 데 문제가 있습니다. (Kitkat API는 있지만 API 21에서는 잘 작동합니다). 통화 활동을 시작하는
내 코드는 다음과 같습니다
Intent callIntent = new Intent(context, CallActivity.class);
callIntent.putExtra(QBServiceConsts.EXTRA_OPPONENTS, (Serializable) qbUsersList);
callIntent.putExtra(QBServiceConsts.EXTRA_START_CONVERSATION_REASON_TYPE,
StartConversationReason.INCOME_CALL_FOR_ACCEPTION);
callIntent.putExtra(QBServiceConsts.EXTRA_CONFERENCE_TYPE, qbConferenceType);
callIntent.putExtra(QBServiceConsts.EXTRA_SESSION_DESCRIPTION, qbRtcSessionDescription);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.getApplicationContext().startActivity(callIntent);
이 장치의 잠금을 해제하는 것입니다.
km = (KeyguardManager) context .getSystemService(Context.KEYGUARD_SERVICE);
kl = km .newKeyguardLock("MyKeyguardLock");
kl.disableKeyguard();
PowerManager pm = (PowerManager) context .getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
wakeLock.acquire();
이 코드는 통화 활동에서 시도했습니다.
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
그리고 내 매니페스트는 다음과 같습니다
<activity
android:name=".ui.activities.call.CallActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
좋은 질문 !!! –