Ich arbeite mit einer "Call" -App.Wake Lock funktioniert nicht in Android Lollipop (API 21) 5.0.2
Ich bekomme ein Problem bei der Freigabe 'Wake Lock' in API 21. (Es funktioniert gut mit> Kitkat API aber API 21).
Mein Code der Anrufaktivität zu starten ist:
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);
Dies ist das Gerät zu entsperren.
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();
Ich habe diesen Code in der Call-Aktivität versucht.
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);
Und mein manifest ist:
<activity
android:name=".ui.activities.call.CallActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
Gute Frage !!! –