简体   繁体   English

Android-无法在显示LayoutParams.TypeSystemError时看到来电

[英]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 提前致谢

  1. 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>

  2. 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(); } 
  3. 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.

相关问题 Android检测来电? - Android detect incoming calls? 延迟来电Android - Delaying Incoming Calls Android android中的来话广播的BroadcastReceiver不起作用 - BroadcastReceiver for Incoming calls in android doesn't work Android结合了两个LayoutParams - Android combining two LayoutParams Android 8.1.0来电通知未显示在启动器/主页上 - Android 8.1.0 incoming call notification not displayed on launcher/home page 创建后台 android 服务以拒绝来电 - create background android service to decline incoming phone calls 创建导航抽屉时出现致命错误-RelativeLayout $ LayoutParams无法转换为android.support.v4.widget.DrawerLayout $ LayoutParams - Fatal Error When Creating Navigation Drawer - RelativeLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams Android中使用sinch的来电通知,我正在使用FireBase Messaging服务,但当应用程序在后台被杀死时却无法接听电话 - Incoming call Notification using sinch in Android ,I am Using FireBase Messaging service but not getting calls when app is killed in background 无法在android studio中查看图像视图 - Cant see the image view in android studio Android:LayoutParams中addRule上的ArrayIndexOutOfBounds异常 - Android: ArrayIndexOutOfBounds Exception on addRule in LayoutParams
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM