Introduction
This MIT App Inventor extension helps you generate a link which redirects to your QR code.
For similar extensions, click on the links below.
Note: Since it generates a link, to display the image, you need internet access.
Create QR code without network extension by Zhangqs
Create QR code without network extension by vknow360
Extension Info
Version: 2
Package name: com.gordonlu.qr
Documentation
AvailableFormats
Available formats for your QR code. Available types of QR codes are UTF-8, Shift_JIS and ISO-8859-1. Returns: list
GenerateQRLink
Generates a link for your QR code. Returns: textParameters:
height | text, width | text, code | text, type | text
Available types of QR codes are UTF-8, Shift_JIS and ISO-8859-1. Placing an empty text string will make it UTF-8.
Note: Do not use number blocks for height and width, since they cause errors. This bug will be solved. Use text blocks instead.
Usage Example
Download Sources
TXT file: QR.txt (1.9 KB)
AIX file: com.gordonlu.qr.aix (6.1 KB)
AIA file: QR.aia (6.7 KB)
Successfully tested on Xiaomi 5G NE Lite.
Source code:
package com.gordonlu.qr;
import android.app.Activity;
import android.content.Context;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import java.util.*;
@DesignerComponent(
version = 2,
description = "This extension helps you to generate a valid link for your QR code.",
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = "https://docs.google.com/drawings/d/e/2PACX-1vQCI87PHLBF0jb8QWyYmIRQSjjNW3EFXf-qpsWCvBYkUQ9vEgPAB8SpxcMpblxNpbIYrjCjLrRLIU2c/pub?w=16&h=16")
@SimpleObject(external = true)
//Libraries
@UsesLibraries(libraries = "")
//Permissions
@UsesPermissions(permissionNames = "")
public class QR extends AndroidNonvisibleComponent {
//Activity and Context
private Context context;
private Activity activity;
public QR(ComponentContainer container){
super(container.$form());
this.activity = container.$context();
this.context = container.$context();
}
@SimpleFunction(description = "Returns all available formats of the QR code.")
public static List<String> AvailableFormats () {
List<String> formats = new ArrayList<>();
formats.add("UTF-8");
formats.add("Shift_JIS");
formats.add("ISO-8859-1");
return formats;
}
@SimpleFunction(description = "Generates a link for the QR code.")
public String GenerateQRLink (String height, String width, String code, String type) {
String make = "https://chart.googleapis.com/chart?cht=qr&chs=" + height + "x" + width + "&chl=" + code + "&choe=" + type;
return make;
}
}
Made with Niotron IDE.
Kindly PM me if you have any questions! Also, if you like my extension, please like it! It takes some effort for me to make it...
This extension is registered on my website. Check that out!