[英]Android - Cant see the incoming calls when LayoutParams.TypeSystemError is displayed
I'm developing lock screen app. 我正在开发锁屏应用程序。 Here Lock screen is displayed on the top of the screen using this command "WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;"
使用此命令“ WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;”将锁定屏幕显示在屏幕顶部。
But my problem is I can't See the Incoming call Window when the custom lock screen is displayed. 但是我的问题是,显示自定义锁定屏幕时我看不到来电窗口。 Incoming call window is not overrided over my custom lock screen.
在我的自定义锁定屏幕上不会覆盖来电窗口。
1) Is there any permission required for displaying the incoming call window.? 1)显示来电窗口是否需要任何权限?
2) We have to add any other codes for answering the incoming class 2)我们必须添加任何其他代码来回答入学课程
This is my Lockscreen receiver class 这是我的锁屏接收器课程
public class LockScreenReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(action.equals(Intent.ACTION_SCREEN_OFF) || action.equals(Intent.ACTION_BOOT_COMPLETED))
{
Intent i = new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
In the normal lock screen apps -> They can attend the incoming calls and after attending that call, lock screen is displayed. 在普通的锁屏应用程序->他们可以接听来电,并在接听该电话后显示锁屏。 How ????
怎么样 ????
Please help me. 请帮我。 Thanks in advance
提前致谢
Add receiver in the manifest and ask for permission 在清单中添加接收者并寻求许可
<receiver android:name=".IncomingCall"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
Create class IncomingCall
创建类
IncomingCall
public class IncomingCall extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { try { TelephonyManager telephonyManager = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); MyPhoneStateListener PhoneListener = new MyPhoneStateListener(); // Register listener for LISTEN_CALL_STATE telephonyManager.listen(PhoneListener, PhoneStateListener.LISTEN_CALL_STATE); } catch (Exception e) { e.printStackTrace(); }
Implement PhoneStateListener
in LockScreen
and call onCallStateChanged
在
LockScreen
实现PhoneStateListener
并调用onCallStateChanged
private class LockScreen extends AppCompatActivity implements PhoneStateListener{ public void onCallStateChanged(int state, String incomingNumber) { //Disable lockscreen when calls come }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.