QR Code reader for android - qr-code

i am making a qr code reader, i came across zxing lib. i was able to successfully incorporate it on my project. however, when using the app i noticed that it requires another application (i.e qr droid app) before i can use it, otherwise the application crashes. is there a way that it won't require another app? or is there other lib that i can use? thanks in advance.
in my code i just called the intent:
Intent qr = new Intent("com.google.zxing.client.android.SCAN");
qr.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(qr, 0);

First, it really requires the Barcode Scanner application. Not sure if that answers your question. Second your app crashes because you are not catching ActivityNotFoundException. In Barcode Scanners open source project ZXing, you will find a module android-integration which has complete correct source code for this integration. And you will find compete source for Barcode Scanner which you could use to build scanning into your own app. Otherwise you really do want to integrate with Barcode Scanner by Intent. It is much easier.

Related

how to implement Exif.PCL in xamarin forms?

I am trying to create a project in which picture is taken to upload from mobile camera, but when it is taken with front camera it rotates upside down (especially Android). I have read suggestions to use Exif.PCL nuget package but dont know how to implement the same. Can anybody help me out with this ?
Thanks
Background
I had the same problem in one of my apps. After trying different approaches I've found several problems with current implementations. Generally I use XLabs, which has media picking capabilities.
Issues
First of all it lacked support for scaling and autorotating images after they are taken. That's your question. So, first of all I had to implement some after-processing as soon as the image was picked.
Second, there are problems with Android and Xamarin.Forms due do how Activities are handled in Android. The way it works on Android is you launch CameraActivity or PhotoGalleryActivity which are actually hosted in a different application. Those Activities use substential amount of system memory, and due to this operating system will try to kill non-forground processes, including your app :) Workarround for this was completely implementing photo taking flow inside of my application by creating photo taking activities from scratch. Thus, I will never leave my app, and Android runtime will never kill my application.
Solution
Taking account all of this, I've implement my own flow of Image capturing. You can find the source code HERE. The basic architecture is following:
I've created IImageService, which has methods for picking images from camera or library.
public interface IImageService
{
Task<IImage> GetImageFromLibrary();
Task<IImage> GetImageFromCamera();
}
Then I've implemented this for iOS and Android separately and used dependency injection. For iOS I use XLabs implementation, cause it works as it should there are no problems with it. For Android I've created several activities to support picking images from Camera and Library: CameraActivity, PhotoGaleryActivity, which basically replace the native image picking activities.
After I pick the image I do scaling and rotating procedure. For iOS I've created UIImageToolbox static class which has GetScaledAndRotatedImage method. For Android it's BitmapToolbox static class which has GetScaledAndRotatedBitmap method.
In my sample application I've created ImageViewModel and ImagePage to demonstrate the usage of IImageService. It should be straightforward.
How to use the sample app?
Let me give a small remark. You can use only XLabs implementation for both iOS and Android and just use BitmapToolbox and UIImageToolbox to implement the scaling and rotation. And this is answer to your question. However, if you want your app to be stable on Android you need to go a little bit dipper.
Install all the necessary nuget packages to your Forms, Droid and iOS projects. You can find the packages that are used by sample application in packages.config file of each project
I use MvvmCross Messenger plugin for broadcast messaging, if you have alternative you can easily replace it. But if you want to use it, don't forget to register dependencies in your AppDelegate and MainActivity
DependencyService.Register();
Add necessary classes to your Forms, iOS and Android projects from sample application. You can use Resharper to fix namespaces for you.
For xaml files, if you drug and drop to forms project default build action and Custom Tool are set to wrong values. Thus click the xaml file, select properties set Build Action to Embedded Resource, and Custom Tool to MSBuild:UpdateDesignTimeXaml
For android project add necessary resources from drawable, drawable-xxhdpi, layout and values folders.
In grid_cell_photo_galery_item.axml file fix namespaces. Replace ImageSample.Droid.Views.SquareRelativeLayout by your namespace.
For Android, right click Android project, select properties, go to Android Manifest and add CAMERA, READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
For Android, right click Android project, select properties, go to Advanced and set Max Heap Size to something like 1G, this is needed because PhotoGalaryActivity uses substantial amount of memory to display images and we need an increased heap size.
For iOS, don't forget to add dependency injection for MediaPicker in AppDelegate - DependencyService.Register<MediaPicker>();
That's all.

Make QR Code to Open Android Application? [duplicate]

2 questions about using a QR code in an Android device:
1. Is it possible to launch a native Android application from a QR code? Maybe by some configured URI schema?
2. Another option which might be useful for me is to have a QR code scanner inside my own app. Will it be possible for me to somehow include a different app that scans QR codes inside my app? Or will I have to implement the scanning myself?
Thanks
To scan barcodes in Android by Intent, see https://github.com/zxing/zxing/wiki/Scanning-Via-Intent
To trigger an app from a QR code, yes, you need to register the app to handle the particular custom URL scheme. This is how the same app can respond to clicks on the web: https://github.com/zxing/zxing/wiki/Scanning-From-Web-Pages
Look at how it registers to handle URLs here: https://github.com/zxing/zxing/blob/master/android/AndroidManifest.xml
1.to use a configured schema you can check this post
Launch custom android application from android browser
Then the you could QR code this scheme just like market://
2. You could use Bar code scanner app and use below code to launch or you could even integrate the zxing library to scan yourself.
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("SCAN_MODE",
"ONE_D_MODE,QR_CODE_MODE,PRODUCT_MODE,DATA_MATRIX_MODE");
startActivityForResult(intent, 0);

PowerBuilder Standard-Script Encryption

So this is the situation. Our company has its own standard codes and windows (for commonly used routines and for inheriting) that we use in developing applications. These "standard codes and windows" is saved in its own library (pbl). Normally when we deploy our software to the client we just compile it to pbd's and exe's, but this time our client wants also the source code of the software. The thing is we don't want our standard codes and windows to be visible when we give the source code to the client. So is there a way to encrypt (shield, hide etc...) the codes.
I hope someone can point me to where should I start researching.
The .pbls contain sources, resources and binaries, while the .pbd contain no source.
If you do not want to leak any source code, just give the .pbd and .exe files.
If you do want to give the source code of the application minus the source code of your standard library, give the all .pbl files but your standard library, and give the .pbd of the standard lib. Thus your client will even be able to recompile the app (providing that the standard lib object are called by, but do not call other pbjects from the application).
Please note that like Java, the PowerBuilder objects can be decompiled from binaries with the right tool.
I am not aware of a mean to encrypt PB source code, but there is the possibility to obfuscate the objects through PB-Protect. I never used it and I cannot tell more about it.
If they're actually looking for insurance should you disappear, perhaps a code escrow service might be acceptable? My company escrows our source at customer request as a paid-for contract line item, I think with Iron Mountain.

ldap queries in Qt

Thinking of implementing a LDAP-viewer in QML. The first step is obviously to make a Qt back-end that can handle ldap-queries. I've read the rfc1823 (ldap tutorial of sorts), but still can't understand where to begin really.
I would be interested in some Qt code that would get me started on some sample LDAP functions, for instance :
connect to a ldap server
do some simple query of any type
close the connection
Edit: code is not required if you can point me to any tutorials/guides as to how one does this in C++ / Qt
I suggest using libldap. Writing a client from scratch is a lot of work. Take a look here for some examples as a kick-off. You can easily integrate that code with Qt.
The OpenLDAP library also has some c++ example included.

In Flex, is it posible to identify if the code is runing on Web or AIR?

I'm coding an app that runs both in the web and on AIR, to avoid copying code arround, I figured I should do 3 kinds of projects on flex builder: Library, Web and AIR projects.
So all my code is on the Library project.
I have accessData.as that extends EventDispatcher to fetch web services and return them as an event. I plan on using this class to also fetch SQLite data for the desktop version, but to do so I need it to decide from wich source to get the data depending on if its Web or AIR.
Anyone know how to do this?
Please refer to this link Detect AIR versus Flash Player from an actionscript library Its more detailed.
You really should have two build targets, one for Web and one for AIR. And your code should be designed in a way that the rest of the system doesnt care what the implementing part is doing, only that it conforms to a certain interface. This way, each build simply replaces the implementing code for each desired platform.
You may find something useful under System or Capabilities in the docs.
Create 2 projects Air and Standalone and create 2 conditional compilation variables for example "standalone" and "air". (more here).
Go to Project->Properties->Flex Compiler and add
For air project:
-define=CONFIG::standalone,false -define=CONFIG::air,true
and for stanalone:
-define=CONFIG::debugging,true -define=CONFIG::air,false
In your code set:
CONFIG::standalone {
trace("this code will be compiled only when air=false and standalone=true");
}
CONFIG::air {
trace("this code will be compiled only when air=true and standalone=false");
}
umm... I just found out a way
var appName:String = Application.application.name;
this works since the web version is called "" and the desktop version is called " desktop"
but if anyone has a better way please go ahead.
thanks.

Resources