QR if statement? - android

I was wondering if anyone has solved this problem. I want to scan a QR code from my android phone that will ultimately launch an Android App. If the app exists, the app is launched with some unique information. If the app doesn't exist then it takes the user the marketplace to download the app. Can this be done?
Any help will greatly be appreciated :)

Sure, you can write an app that can do that. Barcode Scanner actually does some of the things you want (e.g. opening the market from a code), it's open source, if you need some samples take a look there. The project also has a library that you can use to scan QR-/barcodes.
Keep in mind that a QR-code is nothing else than a String in a machine-readable format. You can encode a package name in a code and scan that. When you successfully did that, just test if the app with that package name is present on the device. If yes, run it via an Intent (you can use PackageManager.getLaunchIntentForPackage() for that). If not, link to the market page via Intent.ACTION_VIEW with a market url. You may encode some extras into the QR-codes, depending on which size you choose for these.
The benefit from the package name only is that there are many codes already out there that link to the android market site of a certain app. Their format is
market://search?q=pname:com.example
As you can see, theres already a packagename included (here com.example).
You can parse and use it. If you want extras, you have to encode your own qr-codes though.

Related

AIR / Android, content-URI to AS3-file-path

I registered some file-extensions for my AIR-Android-App, so when a file is selected, my app receives an Invoke-Event in Flash/AS3 with the path to that file.This works fine for files/downloads/links.
However, some Applications provide a a content-uri instead of a direct file-path (e.g. eMail-attachments before they are downloaded).
e.g:
content://gmail-ls/houseatreides#gmail.com/messages/6/attachments/0.1/BEST/false
QUESTION:
How can i turn this into something i can load in AIR/AS3.
Or how can i order the other application to catch the file for ?
If its not possible in AIR, does anyone know of an ANE that gets the job done ?
I found a post how to do it native in JAVA:
How to create a file using content?
Confirmation that is not possible in AIR is also welcome.
Thank you.
verdave

iOS equivalent to Android MODE_WORLD_READABLE

As the title says - is there something in iOS that lets you say 'this file is allowed to be accessed by other apps' - preferably only readable, but read/write would be good enough.
Basically I am trying to place a file outside the sandbox so other apps can read it - preferably via the openURL that points to a local file rather than an http address.
Thanks
Edit:
I just received an answer from Apple Tech support and they told me that this is currently impossible (just after iOS 6 released)
I don't think it's possible to do it the way you describe. Last I checked, apps can only write inside their sandbox dir and cannot read inside other apps' sandboxes (though IIRC there used to be a few other writable directories).
What, exactly, is the end result you are trying to achieve?
If you know the app you want to read the data, you can use a custom URL scheme.
If you have a file of a certain type (extension/content-type, I think), you can use UIDocumentInteractionController to let the user pick an app to open it in.
If you just want to share some data with any app, the closest I can think of is a custom UIPasteboard. OpenUDID does this for a slightly dubious purpose.

Any way for users to communicate a parameter to an Android application?

In Android Live Wallpapers, the usual Android View classes cannot be used (as far as I know). Therefore, if you want to let a user select a file, you would have to write your own File Chooser interface pixel by pixel. This would be an extraordinary endeavor.
Is there any way for users to pass a parameter -- such as a file name or directory location -- to an Android application?
Live Wallpapers have a mechanism to have a settings UI associated with them that can be set when the user is selecting the wallpaper. This is android:settingsActivity described here: http://developer.android.com/reference/android/R.styleable.html#Wallpaper
You might consider using Open Intents. For example, apps like OI File Manager offer intents like PICK_FILE that let other app developers use their functionality. Installing may add several clicks the first time but it's otherwise fairly seamless (just like choosing an attachment from Gmail).
Check out:
Open Intents: Pick Folder
Open Intents: Pick File

Embed login details in APK file, different for each user (or other options?)

We've been asked to create a thin web client on Android for a company with an existing web site, existing users.
They want to send an mms to their users, giving each user their own download URL. This URL will point to an Android apk file that has been created specifically for that user - it will include that user's login, and password, to the website.
i.e. the APK file would have embedded login details.
This would be done in J2ME by storing info in the JDK file.
I can see a simlar question on How to update resources file in apk - but not fully answered.
So:
is there a way to store an "asset" in the apk file that will be a text file, and easily editable by unzipping, editing, rezipping the apk file? (looks like answer is no)
do you know of any similar problems, or have worked on similar apps?
is there advice on how best to accomplish this application? Any sort of embedding of customer info on an automated level would be of interest...
would the best option be to set the app to build with an Ant script, and have the client actually customize the source code and build a new app per user? (this has the con that the client gets the source code, which we'd rather not have)
I have scanned apk tagged questions and can't seem to find a solution to this.
Many thanks,
Richard
I guess you could put it into the apk (or replace a dummy file there) if you use the assets folder for it.
You can obtain the data by filename instead resource-id quite easy:
getResources().getAssets().open(fileName)
Regards,
Oliver
If it absolutely has to be that way, consider distributing two APKs, one with the application and the other containing a file with the handset-specific information. Sign them both with the same key, arrange for them to share a UID and the application will be able to read the file as if it were its own.
The rest of this probably belongs in a comment and not this answer, but I see lots of problems with what you're being asked to do:
The standard behavior for just about every other application out there is to ask for a login and password once when needed and then remember it.
If the user changes his password on your customer's web site, he has to get a new APK for his device instead of just having to reauthenticate.
Any changes to the application will require generation and installation of a new APK for each user.
All it would take is some unwitting user sharing his unique APK with someone else and your whole security model goes right down the tubes.
Less relevant, but still important: If your customer is able to reconstitute a plaintext password from what they have stored, I question their security scheme.

Android Installation of APK via Browser Link

I want to create a web page that has two links. One that downloads the agent itself (which is pretty easy, just linking to the APK file with the appropriate MIME types set), and the other to start the install process for the APK downloaded in step one.
I know they can just pull down the bar and click on it, but that can be confusing for users (especially in the overall process we are trying to create). Is there a special URI I can use to start the installation, sort of like the market link of "market://"?
Also, is there a way to get meta-data surrounding where the APK was actually installed from? For example, if the link for the APK is "http://company.com/setting=123", that I can pull in the "setting=123" from the URL? I suspect not, but I figured it couldn't hurt to ask.
You can add url interceptors to your app like it's mentioned here but AFAIK there is no way to do what you are asking.
check open2go.com
it may help you.
example here
http://open2go.com/http://m.getjar.com/mobile/49757/angry-birds-seasons/
open2go.com/ + url
market: schema works to.

Categories

Resources