我正在开发视频通话 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) 我正在使用connect-busboy在node/express app上传文件.问题有时它可以正常工作(文件上传得非常好),有时我会收到错误Unexpected end of multipart data并且应用程序崩溃.这可能是导致此错误的原因?此外,任何有关如何调试此功能的帮助将不胜感激.我正在使用node version 5 并connect-busboy": "0.2.14"提前谢谢你
router.route('/images')
.post (function(req, res) {
var fstream;
req.busboy.on('file', function (fieldname, file, filename) {
fstream = fs.createWriteStream(__dirname + '/public/img/'+ filename);
file.pipe(fstream);
file.on('end', function() {
console.log('File [' + fieldname + '] Finished sucessfully');
});
fstream.on('error',function(err){
console.log('fstream error' + err);
file.unpipe();
});
fstream.on('close', function () {
res.status(200);
res.json({ message: 'File uploaded' });
});
});
req.pipe(req.busboy);
});
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误
throw er; // Unhandled 'error' event
: Error: Unexpected end of …Run Code Online (Sandbox Code Playgroud)