How to create a QR code that execute command? [duplicate] - android

This question already has answers here:
How to launch my Android app from a QR reader?
(2 answers)
Closed 1 year ago.
I have seen some example that people code executable code on a QR code like this https://itsmattkc.com/etc/snakeqr/. I wanted to create a QR code that executes the command to open a specific phone application for any phone (android & IOS).
The process will be like this,
Scan QR code with a phone.
Phone executes the command that stores inside the QR code (code that does something like "start C:\...\specific app" in C language) and open the App or prompt user to download it if the application is not installed on the phone.
Close the window that is used to execute the command(if any).
My question right now is,
What language can be used to code the command that open the phone application like what I stated above?
How can I turn the code into a QR code?

Background A QR code doesn't itself execute anything, at a high level QR code is just a method of serializing an array of bytes into a visual form, the reader can de-serialize the image back into an array of bytes which must then be interpreted.
Generic QR readers will generally assume that the original data represented an encoded string and so will decode the bytes into a string.
The instructions in SnakeQR tell you to use a QR reader that allow you to save the bytes to disk, instead of decoding them into a string, which just demonstrates that the QR code contains binary data and that the data on its own doesn't do anything, the user needs to take that data and complete the next step to action it, but that action is up to the user.
This is when the magic starts to happen, if the QR code represents or contains a URL, then most reader applications will auto-launch a web browser and will navigate to that URL.
In the app development world we can hijack the default behaviour of these QR code readers to interact with the device in 3 ways:
Write a web page that will execute scripts to complete your operation on the device that navigates to that page, host that somewhere globally accessible and store the URL to that page in your QR code.
Use a URI that the device will recognise as an internal location, this post How to launch my android app from a QR reader is describing this process, in the android application API you can define these intents, effectively registering a URI with a specific action.
The specifics to this are out of scope, this question is about the QR code itself, but most operating systems will have a similar process where there are standard actions bound to URIs and there is usually a mechanism for you to create custom bindings.
Write your own proprietary QR Reader application that can natively understand the commands in the QR code and can execute them direct.
In terms of languages that support this, its not a language specific thing, in Android applications the mechanism you want to exploit is Android Intents Tutorial (Android Developers - Intents).
In iOS there have been mixed version of URL bindings over the years, but SiriKit is probably the closest in terms of functionality, its far more restricted than android, but enough to launch apps and pass through arguments.
In Windows OS you can register URI schemes to do the same thing...
When it comes to proprietary logic, we can use all 3 methods to build a seemless experience for the users:
Make a landing web page with a message like "If you see this page then you should install my app for an enhanced experience..." (on this page there should be instructions for how to find and install your app)
Make the QR code a URL to the landing page with the parameters that you want passed to the app as URL parameters.
Build and publish your app, in this app you should register the URI to the landing page with the native device OS so that after the device is installed, your app runs instead of the user going to the landing page. Don't forget to map any parameters as startup arguments for your app.

Related

How to send text message to Azure Bot?

Totally new to Azure and the services it offers, I face many questions about the "Speech" service and the bots that can be created on the Microsoft platform. Currently developing an Android mobile application I'd like to realize the following behavior:
The user records a voice file from the app (using MediaRecorder), this part is ok
Once the recording is finished, this file is sent to Azure function(via an HTTP POST).
The file is translated into Text
The text is sent (step 7) to the bot which reacts accordingly by executing an HTTP request.
Scheme of the process I explained
First of all I wanted to know if this scenario is possible or if I have to use the Speech SDK on my Android application.
Moreover if this scenario is possible, how do I send the text to the chatbot? I've checked this link but it doesn't seem very relevant to me.
NB: My bot has been completely created using "Bot Framework Composer" for the moment, no code has been written, I just wanted to know if my scenario is plausible and above all possible.
Go through your steps, and I think it can be implemented. If you want to send text to bot, you can refer to this request.
Before that, you may need to start a conversation and get the conversationId.

How to avoid hardcoded urls in IOS/Android app

I'm developing a django web-project and I'm going to develop its IOS and Android API.
Is there a way to avoid using hardcoded url addresses in the app code?Something like django url name system
The following problem faces me if there isn't any solution to my question:
If I want to change some of my urls, I should change the app code and also all the previous installed apps on peoples' devices won't work and should be updated.
The way I see it, you probably have two options:
a) Code very generic forwarding links into your app, such as:
http://www.example.com?linkid=1
http://www.example.com?linkid=2
You can then, from your side, forward these on to where you need them to go by using the query string ID number.
b) Write a web service to push updated URLs to your app, maybe on load so you're not polling the service all the time.
How often are the URLs likely to change?

How to pass data from a web page to an app which is about to be installed on iOS and Android

Is this possible to achieve on iOS and Android with the least manual operation?
The user visit the web page W and W stores data D somewhere (in the device or the server).
The user install app A and A get D (from the device or the server).
I can only think two ways to indirectly achieve the same result:
W asks the user to copy D into the device's clipboard, and then A asks the user to paste D in the app.
W asks the user to write some random string X (and save the mapping from X to D), and then B asks the user to type X (and get D by sending X to backend).
Btw, after googling a while, it looks like current mobile browsers cannot access the clipboard, and W3C is just writing the draft of clipboard API (2014/09/18 http://www.w3.org/TR/clipboard-apis/ ), so using clipboard as a "hack" to pass data automatically is not possible currently.
We also struggled with this when we built our last mobile app, Kindred Photobooks. We actually created a native library for iOS and Android to do just this - give you the ability to pass data past install. The best way we found is to basically bundle that information in the link and use fingerprinting to make that data available after install, which is working really well.
You can try to build fingerprinting in in house as well - basically create an outstanding device fingerprint once someone clicks on the link and match it to the fingerprint that you create once a user
We automated everything and made sure all the edge cases work on both Android and iOS. Check us out at branch.io and if you are curious on how our links work, you can read more here.
I don't exactly what you want to do, but, you can for example, on the web page, ask the user to enter some info, and then you send to his email a code, then he can share that code with other people, and inside the application, you create a section, so user can enter a code. Using that code, the app makes an HTTP call to the server, and the response can be the info entered by the first user. Of course you are going to need a database.

How to use barcode scanner to send data to PC using WiFi

Is it possible to store the UPC to your Android device, (excel or notepad) after scanning, and be able to send it to PC via WiFi? And make the data directly go into notepad or excel?
I'm developing an inventory system using the Android WiFi scanner. Please help me because I'm having a hard time searching if this is feasible.
I am actually working on this exact project for my work!
I downloaded an app called ScanPet! (you will also need to download Barcode Scanner - also free, and you dont need to do anything with the app) It will scan a barcode and automatically store the serial number. You can then input a couple other fields manually like model, price, comments, and a few others. The app stores it all in an excel doc that you can then email to yourself.
If you are using outlook, then its rather easy to scan the inbox, grab the attachment, open it, and then input the data from the excel doc into your database!! As you said, a batch call can be setup to scheduel the task as well!! Best of luck automating friend!

Adding custom parameters to .APK or QR-code

I’m building an Android application that I want to publish only once, but want it to connect to 2 different servers. The application will be downloadable with a QR-code
For example, my friend has a moviedatabase on his own server and I have one. Without manually writing the server url in the application settings, I wanted to modify the .APK file or the QR code, giving it a parameter. So when my friend scans in the QR-code which I make for him, I want his app to connect with his server. When I scan my QR-code I wanted it to connect to mine. Right after the installation of the .APK.
Is this possible? Or are there any suggestions how I can put the server url “somewhere” without entering it manually in the code?
There is another option. Making a textfield that the user can fill by scanning a QR-code. But for me, that is still manually entering the URL.
Any suggestions or advice are welcome.
What is the problem to store server url in preferences and make an extra Activity to grab qr from camera and change the preference
This isn't supported functionality on install. There's no way to link to an Android Market url with extra information to be executed as a post-install script. You can include a QR code scanner in your app (I believe ZXing is open source and/or free to use, for example), and you can have the server info encoded in the QR code. You can save this to any persistent storage (such as SharedPreferences or SQLite) and then use this for all future data requests.

Categories

Resources