In this section you will find the necessary information to enable your app to detect and react to Bidco& tags.

Merchants use the Bidco Merchant API to generate tags for their products, catalogs, coupons and Acts and then place the tags on their eCommerce sites and in printed media for their customers to interact with.

Once implemented, your app will be able to retrieve the workflows associated with these tags.

The tag types currently supported are:

  • Barcode - A QR code that has been encoded with the information needed to retrieve a workflow.
  • Touch To Buy - When viewing a merchants eCommerce site on a Mobile device a button is visible instead of a QR code. This button is used to retrieve the workflow.

Detecting Barcode Tags

  1. Barcode tag detection requires use of the system camera. Add the following entry to your Package.appxmanifest:
<DeviceCapability Name="webcam" />

  1. Create handlers for all BarcodeTagDetector events:
private void OnBarcodeTagDetected(object sender, BarcodeTagDetectedEventArgs e) 
{
   MessageBox.Show(e.BarcodeTag.Reference);
}

private void OnNonPowaTagBarcodeDetected(object sender, NonPowaTagBarcodeDetectedEventArgs e) 
{
   //Barcode detected that is not a PowaTag barcode.
   MessageBox.Show(e.BarcodeTag.Reference);
}

private void OnDetectorStarted(object sender, DetectorStartedEventArgs e) { }

private void OnDetectorStopped(object sender, DetectorStoppedEventArgs e) 
{
	if (e.Exception != null)
	{
	// detector stopped due to exception
	}
}

  1. Create BarcodeTagDetector instance and assign EventHandlers:
BarcodeTagDetector barcodeTagDetector = new BarcodeTagDetector();
barcodeTagDetector.OnBarcodeTagDetected += OnTagDetected;
barcodeTagDetector.OnNonPowaTagBarcodeDetected += OnNonPowaTagDetected;
barcodeTagDetector.OnDetectorStarted    += OnDetectionStarted;
barcodeTagDetector.OnDetectorStopped    += OnDetectionStopped;

  1. Call StartDetection and StopDetection according to your App lifecycle, for example when navigation happens:
protected override async void OnNavigatedTo(NavigationEventArgs e) 
{
   await barcodeTagDetector.StartDetectionAsync(captureElement);
}

protected override void OnNavigatedFrom(NavigationEventArgs e) 
{
   barcodeTagDetector.StopDetection();
}

  1. To check if the barcode tag detector is actively listening for tags:
barcodeTagDetector.IsDetecting();

Detecting "Touch to Buy" Tags

  1. Touch to Buy tag detection requires adding “bidcodemo” protocol name into your Package.appxmanifest:
<Extensions>
<uap:Extension Category="windows.protocol">
	<uap:Protocol Name="bidcodemo" />
	</uap:Extension>
</Extensions>

Note: An example scheme is being implemented here. This should be replaced with the scheme you are using.


  1. Override OnActivated method in your App.xaml.cs to handle Protocol activation kind:
protected override void OnActivated(IActivatedEventArgs args)
{
	DispatcherHelper.Initialize();

	Frame rootFrame = Window.Current.Content as Frame;
	if (rootFrame == null)
	{
		rootFrame = new Frame();
		rootFrame.NavigationFailed += OnNavigationFailed;
		// Place the frame in the current Window
		Window.Current.Content = rootFrame;
	}

	if (args.Kind == ActivationKind.Protocol)
	{
		ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;
		Windows.Storage.ApplicationData.Current.LocalSettings.Values[App.AppLinkUrl] = eventArgs.Uri.ToString();
		// navigate to a desired page
	}

	Window.Current.Activate();
}
  1. In WorkflowPage.OnNavigatedTo method process the app link if present:
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
	try
	{
		if (e.Parameter != null)
		{
			var isLinkProcessed = await this.ProcessAppLink(e.Parameter.ToString());
			if (!isLinkProcessed)
			{
				return;
			}
		}

		await this.viewModel.GetWorkflowAsync();
	}
}

private async Task<bool> ProcessAppLink(string url)
{
	object endpoint;

	if (!Windows.Storage.ApplicationData.Current.LocalSettings.Values.TryGetValue(App.ENDPOINT, out endpoint))
	{
		await this.DisplayAppLinkError();
		return false;
	}

	await PowaTagKit.InitializeSdkAsync(endpoint.ToString(), App.APPID, App.APPNAME);

	if (!ManagerFactory.GetInstance().LoginManager.IsLoggedIn)
	{
		await this.DisplayAppLinkError();
		return false;
	}

	AppLink appLink = new AppLinkTagDetector(new HashSet<string> { "bidcodemo" }).DetectAppLink(url);

	App.CurrentTag = appLink.Tag;
	return true;
}

Next Steps

Use the Bidco tag to retrieve the associated workflow.