相关疑难解决方法(0)

禁用锁定屏幕

我正在寻找一种方法来替换股票锁定屏幕(使用应用程序,而不是rom).最好的方法是什么,开始在尽可能多的设备上禁用锁定屏幕?谢谢!

android

23
推荐指数
3
解决办法
3万
查看次数

全屏通知,如 Android 通话应用中的来电

我正在开发视频通话 android 应用程序。我现在面临的挑战是在您有来电时实现类似于内置在 Call 应用程序中的 android 的全屏通知。目前,每当我接到电话时,如果手机屏幕关闭,通知就会显示为常规通知,如果手机醒着,则通知显示为常规通知。我希望通知像通话应用程序一样占据全屏。我正在使用 Galaxy S5 来测试它。什么我在这里缺少的是我的代码。提前致谢。

        Intent intent = new Intent(this, MainActivity.class);
        intent.putExtra("screen", "debugScreen");
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                | Intent.FLAG_ACTIVITY_NO_USER_ACTION);
        Intent callAcceptIntent = new Intent(this, MyReceiver.class);
        callAcceptIntent.setAction("com.videochat.CALL_INTENT");

        PendingIntent callAcceptPi = PendingIntent.getBroadcast(this,0,callAcceptIntent,0);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);

        NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this)
                    .setContentIntent(pendingIntent)
                    .setSmallIcon(R.drawable.icon)
                    .setContentTitle("My notification")
                    .setContentText("Hello World!")
                    .setTicker("ticker")
                    .setFullScreenIntent(pendingIntent, true)
                    .setOngoing(true)
                    .setCategory(NotificationCompat.CATEGORY_CALL)
                    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
                    .setPriority(NotificationCompat.PRIORITY_MAX)
                    .addAction(R.drawable.icon, "Reject",callAcceptPi);

                NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Run Code Online (Sandbox Code Playgroud)

android android-layout

7
推荐指数
0
解决办法
5293
查看次数

标签 统计

android ×2

android-layout ×1