I want to save the Contacts numbers in my phone using QR code data in Flutter.
Using this package for managing user contact book on Android & iOS and this package or any other with qr scanning ability.
First create a template for qr information. Flutter contacts lets you save with vCard format which would be very useful, or just have contact name & number raw in qr data.
Once you have consistent formatting of qr data, after user scans code, pass data inside it to a new contact:
final newContact = Contact()
..name.first = 'John' //<- value from qr code
..name.last = 'Smith' //<- value from qr code
..phones = [Phone('555-123-4567')]; //<- value from qr code
await newContact.insert();
More information available in package descriptions.
Related
What is the approach for using standard i/o in flutter? I've tried the following code but there is no render and build gets stuck.
import 'dart:io';
void main() {
stdout.writeln("Enter value");
String str = stdin.readLineSync();
// user inputs value
print(str);
}
The documentation says
> To read text synchronously from the command line (the program blocks
> waiting for user to type information):
String inputText = stdin.readLineSync();
But how to appropriately input values? Because flutter run doesn't let me input values.
Actually, what you're doing doesn't require you to use Flutter. You can run it using Dart. The thing is that Flutter is meant for application development for Android, iOS, Web and other such platforms. It isn't created for such applications that you desire.
I need to create QRCode image with app registered users 4 parameters, so that if i scan that QRCode image from other device i need to display that user details, that is my requirement.
here i am getting registered user details: with these parameters i need to generate QRCode image
var userId = userModel?.userId
var userType = userModel?.userType
var addressId = userModel?.userAddrId
var addressType = userModel?.userAddrType
according to [this answer][1] i have created QRCode with string... but i. need to generate with my registered user parameters
sample Code with string:
private func createQRFromString(str: String) -> CIImage? {
let stringData = str.data(using: .utf8)
let filter = CIFilter(name: "CIQRCodeGenerator")
filter?.setValue(stringData, forKey: "inputMessage")
filter?.setValue("H", forKey: "inputCorrectionLevel")
return filter?.outputImage
}
var qrCode: UIImage? {
if let img = createQRFromString(str: "Hello world program created by someone") {
let someImage = UIImage(
ciImage: img,
scale: 1.0,
orientation: UIImage.Orientation.down
)
return someImage
}
return nil
}
#IBAction func qrcodeBtnAct(_ sender: Any) {
qrImag.image = qrCode
}
please suggest me
[1]: Is there a way to generate QR code image on iOS
You say you need a QR reader, but here you are solely talking about QR generation. Those are two different topics.
In terms of QR generation, you just need to put your four values in the QR payload. Right now you’re just passing a string literal, but you can just update that string to include your four properties in whatever easily decoded format you want.
That having been said, when writing apps like this, you often want to able to scan your QR code not only from within the app, but also any QR scanning app, such as the built in Camera app, and have it open your app. That influences how you might want to encode your payload.
The typical answer would be to make your QR code payload be a URL, using, for example, a universal link. See Supporting Universal Links in Your App. So, first focus on enabling universal links.
Once you’ve got the universal links working (not using QR codes at all, initially), the question then becomes how one would programmatically create the universal link that you’d supply to your QR generator routine, above. For that URLComponents is a great tool for encoding URLs. For example, see Swift GET request with parameters. Just use your universal link for the host used in the URL.
FWIW, while I suggest just encoding a universal link URL into your QR code, above, another option would be some other deep linking pattern, such as branch.io.
the scanner detects the barcode string but not the format (EAN_8, EAN_13)
i use ionic 4 and building for android devices
i need to know the barcode format from the scanner that uses Laser ligth, the barcodescanner ionic native plugin only uses the camera, which is not my case.
Many laser scanners default to not transmitting the barcode format referred to as a Code ID. However there is often an option that allows you to prepend or append a character representing the Code ID scanned. For example on page 13-3 of the LS2208 Product Reference Guide, you will find three configuration barcodes that will enable most Symbol scanners to add characters to the beginning of the barcode string.
For the particular use case cited, you would want your scanner to be set for AIM Code ID and expect a string of "]E0" to precede a string from a EAN 13 symbol and a string of "]E4" to precede a EAN 8 symbol.
I have been really cracking my head trying to write and read png files into a folder in Windows Phone 8. From few blogs sites and codeplex i found that the there is an extension to the WritableBitmap Class which provides few extra functionalities. ImageTools has PNG encoder and decoder. But I really cant find examples to use them.
What Im trying to achieve here is to create a folder called page and then in it a file called Ink File. I want to convert the bitmap to a PNG and store it there. The bitmap is created from the strokes drawn on a canvas. The class ImageTools provides a function called ToImage to convert the strokes from the canvas to image.
For storing
ExtendedImage myImage = InkCanvas.ToImage();
var encoder = new PngEncoder();
var dataFolder = await local.CreateFolderAsync("Page", CreationCollisionOption.OpenIfExists);
StorageFile Ink_File = await dataFolder.CreateFileAsync("InkFile", CreationCollisionOption.ReplaceExisting);
using (var stream = await Ink_File.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite))
{
using (var s = await Ink_File.OpenStreamForWriteAsync())
{
encoder.Encode(myImage, s);
await s.FlushAsync();
s.Close();
}
}
Is this a correct method? I receive some null exceptions for this. How do i find if the image is saved as png. How is this image saved? Is it encoded and saved in a file or is it saved as a png itsef. And how do we read this back?
I have checked out this, this , this and lot more like this.
I'm developing app for WP8
I have used the PNG Writer Library found in ToolStack and it works :)
I write a small program to get location information using MKReverseGeocoder.
The return is like :
Country = "\U53f0\U6e7e";
CountryCode = TW;
I know this is unicode, but any function in iPhone SDK help convert this to readable string?