Is there any method equivalent to getServingUrl() in swift/objective c? - android

Currently I'm using google app engine images for image transformations for my android app. The images will be trasformed on the fly and we can access the image with unique urls, which are generated by the getServingUrl() mathod. The documentation for which is available in https://cloud.google.com/appengine/docs/java/images/. But there is no documentation on how it can be done in ios application. Is there any equivalent method to getServingUrl() in swift code? Or google app engine doesnt support IOS?

You can always use:
https://storage.googleapis.com/{bucket name}/{image path}
where the default bucket name is typically your_app_name.appspot.com, and the image path is the name you gave the image when you stored it, like photos/avatars/user12345

Related

How to display a TIFF image in a Flutter app on an Android device?

Our application allows users to set up a library of various types of resources such as PDFs, spreadsheets, etc. I.e. just about any MIME type of document, which we store on S3.
When a user clicks to view any of these resources we basically determine if we are on an iOS device or Android. On iOS we use url_launcher to basically show just about anything.
Android is a bit more complex, but if the mime type is an image we just also use url_launcher. If not we download the file to a local file and invoke the OpenFile package to show the result (if we can).
This works generally pretty good, except for TIFF image types, which don't display natively in the browser...
Is there an easy way to show TIFF images in a full flutter screen (similar to showing it in a browser) on the Android platform? Actually for image/ mime types is there an easier way to show them rather than url_launcher in general?
The other Stack Overflow question about TIFF on Android does not address this issue as that is for a native Android app and this is for Flutter and that solution doesn't lend itself (easily that I can see) to a Flutter application.
The question is quite old but i still want to answer it :)
What you can do with the Image Library is to decode the image (whatever it is) and then encode it as a png and then pass it to the Image Widget.
Why PNG??? => in widgets/images.dart it says
/// This only accepts compressed image formats (e.g. PNG). Uncompressed
/// formats like rawRgba (the default format of [dart:ui.Image.toByteData])
/// will lead to exceptions.
Todo:
I had to import the Image Library as imgLib otherwise it was colliding with the Image Widget from Flutter...
import 'package:image/image.dart' as imgLib;
....
imgLib.Decoder dec = imgLib.findDecoderForData(response.data);
Image.memory(imgLib.encodePng(dec.decodeImage(response.data)))
Then you have an Image Widget for displaying it on the UI

Using Android native image from a NativeScript plugin

I'm writing a NativeScript plugin for the Stripe library. On Android, I can't figure out how to turn a resource ID from the native library into a drawable image.
One of the calls I make returns an ID obtained from R.drawable.xxx. The image is in the native library's resources. I want to turn that into an image I can draw using the tag.
I have tried this code:
import { android as androidApp } from "application";
let res = ...; // obtained from native library
let image = android.graphics.BitmapFactory.decodeResource(
androidApp.foregroundActivity.getResources(),
res);
but decodeResource() returns null. The native library is able to draw the same image, so somehow the resource is getting into the app. I just don't know how to access it from my code.
Note: On iOS this same call returns a UIImage, which is working correctly. I wish Stripe had been more consistent between their iOS and Android APIs!
I figured out the problem. Turns out my diagnosis was incorrect. The resource was being found, but it was a VectorDrawable and decodeResource() is unable to properly decode it.
The technique for converting a VectorDrawable to a Bitmap posted in this question works.

How to recognize image which template is stored in the app

It needs recognize icons. For example, the app scans with with phone camera and recognizes one of the icons below and if it recognized then the app performs some action. It recognizes it by comparing with icons stored in the app.
Any libs, manuals, please.
And how to name this task if to search it: optical image recognition? (This is not OCR because recognizing image, not text, right?)
Thank you very much!
how to compare set of images in java using pixel based image comparision metric based on mean squared error?
Image Comparison Techniques with Java
Java library to compare image similarity
Google "java code to compare two images"
Also you can try perform and compare MD5 of both images, but i can't guarantee it will work(depends on your situation and if the files are the same).

Convert I18n Iphone Files to Android

I have an iOS App localized (with Localizable.strings files).
I've built now an Android version. I understand the way the i18n is made on android but I would like to avoid redoing the i18n, as almost all the Strings have the same meaning between iOS and Android.
Are there any tools that will do this conversion, or at least speed up the process?
Edit:
Ideally I would like to find a method/tool that would do the following
Input:
'iOS Localizable.strings files-(en,fr,it,pt,etc)'
'res/values/strings.xml'
Output:
'res/values-en/strings.xml'
'res/values-fr/strings.xml'
'res/values-it/strings.xml'
'res/values-pt/strings.xml'
'res/values-etc/strings.xml'
There is a specialised service here: Loco.
There are threads here on SO which deal with conversation:
Are there any tools to convert an Iphone localized string file to a string resources file that can be used in Android?
Any tool to convert Android's XML localization to iPhone's .strings file?
Another possiblity would be to use an online translation service. These services accepts text not only in Android and iPhone but also in many other formats. Upload the android text and download the iPhone text. A list of available services can be found on SO, see Any collaborative tool/website to localize an Android app? Some of these services are commercial, but even these provide a 30days test period. But note that the main focus is on translation and not on conversation.
Here is some code that does that: https://github.com/wrapp/LocalizedStrings2Android
Put it in a jar and it is ready to use.
You can use this tool I created on JSFiddle:
https://jsfiddle.net/danielgindi/x9njj9gj/
[StackOverflow requires me to write some code here because of the JSFiddle link]
Just paste in your localization strings inside the correct box, and you'll get the converted version in the other boxes (Between Android, iOS, and JS).
This tries to preserve comments too.
Cheers!

QR if statement?

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.

Categories

Resources