Posts

Showing posts from April, 2017

Read Exif tag of JPG using ExifInterface(String filename), with Requesting Permissions at Run Time for Android 6.0 (API level 23) or higher.

Image
Last post show how to  Read Exif tag of JPG using ExifInterface(String filename), with Target Sdk Version to API 22 . As mentioned, beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. It need extra handle of Requesting Permissions at Run Time . This example add handle Requesting Permissions at Run Time, to make it Target Sdk Version API 25. uses-permission of "android.permission.READ_EXTERNAL_STORAGE" is needed in AndroidManifest.xml, refer last post . For the layout, refer to the example in Read Exif tag of JPG using ExifInterface(FileDescriptor) . MainActivity.java package com.blogspot.android_er.androidexif; import android.Manifest; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.ExifInterface; import android.net.Uri; imp

Read Exif tag of JPG using ExifInterface(String filename)

Image
Last posts show how to  Read Exif tag of JPG using ExifInterface(FileDescriptor) and using ExifInterface(InputStream) . But both ExifInterface(FileDescriptor) and ExifInterface(InputStream) added in API level 24, Android 7.0. In this post, I will show how to use ExifInterface(String filename), added in API level 5. Such that we can set Min Sdk Version to API 19. To use ExifInterface(String filename), uses-permission of "android.permission.READ_EXTERNAL_STORAGE" is needed. Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. It need extra handle of  Requesting Permissions at Run Time . To make it simple, we can set Target Sdk Version to API 22. AndroidManifest.xml package="com.blogspot.android_er.androidexif"> android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIc

Read Exif tag of JPG using ExifInterface(InputStream)

Image
Last post show how to open image of jpeg using Intent.ACTION_OPEN_DOCUMENT (added in API level 19), then display the image and read the Exif tag using ExifInterface (FileDescriptor)(added in API level 24) . Here is another alternative using ExifInterface(InputStream) (added in API level 24) to read Exif. Simple modify the method showExif(Uri photoUri). All other follow the last example. It have the same result: void showExif(Uri photoUri){ if(photoUri != null){ /* How to convert the Uri to InputStream, refer to the example in the document: https://developer.android.com/guide/topics/providers/document-provider.html */ try { InputStream inputStream = getContentResolver().openInputStream(photoUri); /* ExifInterface (InputStream inputStream) added in API level 24 */ ExifInterface exifInterface = new ExifInterface(inputStream) ;

Read Exif tag of JPG using ExifInterface(FileDescriptor)

Image
android.media.ExifInterface is a class for reading and writing Exif tags in a JPEG file or a RAW image file. Supported formats are: JPEG, DNG, CR2, NEF, NRW, ARW, RW2, ORF, PEF, SRW and RAF. Attribute mutation is supported for JPEG image files. This example show how to open image of jpeg using  Intent.ACTION_OPEN_DOCUMENT (added in API level 19), then display the image and read the Exif tag using  ExifInterface (FileDescriptor) (added in API level 24). Please notice: Because ExifInterface (FileDescriptor) is used here, so the min Sdk Version have to be set API 24. To convert the Uri return by Storage Access Framework to FileDescriptor, refer to the example in the document " Open Files using Storage Access Framework ". MainActivity.java package com.blogspot.android_er.androidexif; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.ExifInterface; import android.net.Uri; import

Introduction videos for Android Things

Image
I found two Youtube videos good for Android Things, published by  The Linux Foundation . Android Things: High Level Introduction - Anisha Dattatraya & Geeta Krishna, Intel Corporation An overview of the basic concepts behind Android things and its structure and components is presented. Upon completion of this session, you should have a good overview of how Android Things brings simplicity to IoT software and hardware development by providing a simple and secure deployment and update model. This presentation provides the context needed for the Android Things Tutorial and other deep dive sessions for Android Things. About Geeta Krishna I've been involved in Unix based OS development since the 1990s. Most of my career has been spent in system level development of High Availability and Distributed Systems software technology. More recently, I have taken on Engineering Management roles for Tizen In Vehicle Infotainment and Intel's Reference Design for Android. I currently work f