2017-07-18 189 views
0

我想在我的应用程序中实现扫描条码扫描器。我下载了它的样品演示和它的工作正常。Scandit条码扫描器在扫描时显示空白相机

我尝试在我的应用程序中实现的相同代码,但它显示扫描时出现黑屏。 我也给了相机访问。找不到任何遗漏的东西。

请帮助,如果有人也面临同样的问题。任何建议最受赞赏。 由于事先

这是我的代码

using FormBot.ViewModels.Abstract; 
using Scandit.BarcodePicker.Unified; 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows.Input; 
using Xamarin.Forms; 

namespace FormBot.ViewModels 
{ 
public class SerialNumberViewModel: BaseViewModelDemo 
{ 
    private string _recognizedCode; 

    public ICommand StartScanningCommand => new Command(async() => await StartScanning()); 

    public string RecognizedCode 
    { 
     get 
     { 
      return (_recognizedCode == null) ? "" : "Code scanned: " + _recognizedCode; 
     } 

     set 
     { 
      _recognizedCode = value; 
     } 
    } 

    public SerialNumberViewModel() 
    { 

     ScanditService.ScanditLicense.AppKey = "Key"; 
     ScanditService.BarcodePicker.DidScan += BarcodePickerOnDidScan; 
    } 

    private async void BarcodePickerOnDidScan(ScanSession session) 
    { 
     RecognizedCode = session.NewlyRecognizedCodes.LastOrDefault()?.Data; 
     await ScanditService.BarcodePicker.StopScanningAsync(); 
    } 

    private async Task StartScanning() 
    { 
     await ScanditService.BarcodePicker.StartScanningAsync(false); 
    } 
} 

}

在app.xaml.cs

private static string appKey = "key"; 
ScanditService.ScanditLicense.AppKey = appKey; 
+0

也许显示你的一些代码,我们不能只为随机猜测可能的答案。 – Digitalsa1nt

+0

@ Digitalsa1nt我用代码更新了que –

回答

0

设置Android的硬件加速= true在Androidmanifest.xaml文件工作了我。