Coder Social home page Coder Social logo

bryant1410 / androidcamerautil Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ralfgehrer/androidcamerautil

0.0 2.0 0.0 770 KB

A util project to take pictures on Android devices utilizing the camera intent.

License: Apache License 2.0

Java 100.00%

androidcamerautil's Introduction

Android Camera Util

It seems to be the simplest thing in the world: taking a picture within your Android app using the default camera activity. However, there are many pitfalls which are covered in several posts across the web as, for instance, null intents being passed back, the orientation of the picture not being correct or OutOfMemoryErrors. Finally, I managed to get it working on a wide variety of devices (see list below) and I wanted to share my solution with you. The code is partially based on the following posts:

I tried hard to avoid implementing different strategies based on the device configuration (e.g. manufacturer, model, ...). Unfortunately, I did not get around it. Going through hundreds of posts and talking to several developers, nobody found a solution that works on all devices without implementing device configuration specific code.

The code was successfully tested on the following devices with Android API-Level >= 8 and stock Android.

  • Alcatel One Touch 992D
  • Alps Cynus T1
  • Alps Cynus T5
  • Alps Cynus F3
  • Asus Nexus 7
  • Caterpillar CAT B15
  • Fairphone FP1
  • HTC Desire C
  • HTC Desire S
  • HTC Desire X
  • HTC Sensation
  • HTC One
  • HTC One Mini
  • HTC One S
  • HTC One SV
  • HTC One X
  • HTC One X+
  • HTC One V
  • HTC One M8
  • Huawei y300-0100
  • Huawei p6-u06
  • Huawei u8510
  • Huawei u9200
  • Huawei Ascend Y201 Pro (u8666e)
  • LGE Nexus 4
  • LGE Nexus 5
  • LGE Optimus L3 (lg-e400)
  • LGE Optimus L5 II (lg-e455 and lg-e460)
  • LGE Optimus L7 (lg-p700)
  • LGE Optimus L7 II (lg-p710)
  • LGE Optimus L9 (lg-p760)
  • LGE Optimus 4X (lg-p880)
  • LGE Optimus Black (lg-p970)
  • LGE Optimus G E975 (lg-e975)
  • LGE Optimus 3D (lg-p920)
  • LGE Prada (lg-p940)
  • LGE G2 (lg-d802)
  • Medion p4013
  • Motorola Defy (mb525)
  • Motorola Moto G (xt1032)
  • No.1 N3
  • Samsung Galaxy W (gt-i8150)
  • Samsung Galaxy Ace 2 (gt-i8160)
  • Samsung Galaxy S3 mini (gt-i8190)
  • Samsung Galaxy S (gt-i9000)
  • Samsung Galaxy S Plus (gt-i9001)
  • Samsung Galaxy S Advanced (gt-i9070)
  • Samsung Galaxy SL (gt-i9003)
  • Samsung Galaxy S2 (gt-i9100 and gt-i9100g)
  • Samsung Galaxy S2 Plus (gt-i9105p)
  • Samsung Galaxy S3 (gt-i9300 and gt-i9305)
  • Samsung Galaxy S3 mini (gt-i8190n)
  • Samsung Galaxy S4 (gt-i9505 and gt-i9506)
  • Samsung Galaxy S4 Active (gt-i9295)
  • Samsung Galaxy S4 Mini (gt-i9195)
  • Samsung Galaxy R (gt-i9103)
  • Samsung Galaxy Note (gt-n7000)
  • Samsung Galaxy Note 2 (gt-n7100 and gt-n7105)
  • Samsung Galaxy Note 3 (sm-n900t)
  • Samsung Galaxy Note 10.1 (gt-n8000)
  • Samsung Galaxy Tab (gt-p1000)
  • Samsung Galaxy Tab 2 (gt-p3110)
  • Samsung Galaxy Tab 3 (sm-t310 and sm-t315)
  • Samsung Galaxy Fit (gt-s5670)
  • Samsung Galaxy Ace (gt-s5830 and gt-s5830i)
  • Samsung Galaxy Ace Plus (gt-s7500)
  • Samsung Galaxy Young Duos (gt-s6312)
  • Samsung Galaxy Mega (gt-i9205)
  • Samsung Galaxy Mini (gt-s6500)
  • Samsung Galaxy Note 3 (sm-n9005)
  • Samsung Galaxy Note 8.0 (gt-n5110)
  • Samsung Galaxy Note 10.1 (gt-p5210 and sm-p600 and sm-p605)
  • Samsung Galaxy Nexus
  • Samsung Galaxy Xcover (gt-s5690)
  • Sony Xperia Z (c6603)
  • Sony Xperia Z1 (c6903)
  • Sony Xperia Ray (st18i)
  • Sony Xperia E dual (c1605)
  • Sony Xperia P (lt22i)
  • Sony Xperia V (lt25i)
  • Sony Xperia U (st25i)
  • Sony Xperia Go (st27i)
  • Sony Xperia Tipo (st21i)
  • Sony Xperia Sola (mt27i)
  • Sony Xperia Arc (lt15i)
  • Sony Xperia Arc S (lt18i)
  • Sony Xperia Neo V (mt11i)
  • Sony Xperia S (lt26i)
  • Sony Xperia Arc S (st18i)
  • Sony Xperia Ion (lt28h)

With regards to custom Roms, the code was successfully tested on the following devices with Android API-Level >= 8 and the CyanogenMod.

  • Samsung Galaxy S Plus (gt-i9001)
  • Samsung Galaxy Nexus S

Please feel free to check out the code. CameraIntentHelperActivity provides the main functionality.

TakePhotoActivity is an example Activitiy on how to use the CameraIntentHelperActivity.

androidcamerautil's People

Contributors

ralfgehrer avatar bryant1410 avatar slake07 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.