# Development of processing for android

**URL:** <https://discourse.processing.org/t/development-of-processing-for-android/17510>\
**Category:** Processing for Android\
**Created:** [February 2, 2020, 11:28am UTC](https://discourse.processing.org/t/development-of-processing-for-android/17510 "2020-02-02T11:28:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pallav12](https://avatars.discourse-cdn.com/v4/letter/p/34f0e0/32.png) [@pallav12](https://discourse.processing.org/u/pallav12)\
**Post date:** [February 2, 2020, 11:28am UTC](https://discourse.processing.org/t/development-of-processing-for-android/17510/1 "2020-02-02T11:28:34Z")

</div>

Hello everyone  
I created [pull request](https://github.com/processing/processing-android/pull/587) in processing for android a month back, It’s already approved. Any mentor please review or merge it.

Thanks

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 3, 2020, 4:56am UTC](https://discourse.processing.org/t/development-of-processing-for-android/17510/2 "2020-02-03T04:56:23Z")

</div>

Meanwhile code below is working on my Samsung S4 Lollipop (Although depricated )  
I’ll try to write a code for newer camara mode

```auto

import android.hardware.Camera;
import android.hardware.Camera.Parameters;

public static Camera cam = null;
boolean on;

void setup () {
  cam = Camera.open();
}

void draw () {
}

void mousePressed () {
  Parameters p = cam.getParameters();
  if (p.getFlashMode() != null) {
    if (on) {
      p.setFlashMode(Parameters.FLASH_MODE_OFF);
      cam.setParameters(p);
      cam.stopPreview();
    } else {
      p.setFlashMode(Parameters.FLASH_MODE_TORCH);
      cam.setParameters(p);
      cam.startPreview();
    }
  }
  on = ! on;
}

void onStop () {
  cam.release();      
  cam = null;
}

```

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 3, 2020, 2:10pm UTC](https://discourse.processing.org/t/development-of-processing-for-android/17510/3 "2020-02-03T14:10:01Z")

</div>

@pallav12  
I remembered that the Ketai lib also handles flashlight. You can find the code [here](https://github.com/ketai/ketai/blob/master/src/ketai/camera/KetaiCamera.java)  
You can find the related code beginning at line 390. It does however also use the “Camara api”, not the newer camara2.  
If you have a device using android above lollipop, please comment if you have any problems.

---

<div class="post-metadata">

**Author:** ![pallav12](https://avatars.discourse-cdn.com/v4/letter/p/34f0e0/32.png) [@pallav12](https://discourse.processing.org/u/pallav12)\
**Post date:** [February 3, 2020, 2:32pm UTC](https://discourse.processing.org/t/development-of-processing-for-android/17510/4 "2020-02-03T14:32:24Z")

</div>

Thanks @noel that works great… I just thought that there should be a built in method in PApplet since opening flashlight is a basic android function.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 3, 2020, 3:45pm UTC](https://discourse.processing.org/t/development-of-processing-for-android/17510/5 "2020-02-03T15:45:26Z")

</div>

Please tell me the name of android version and device that you used.

---

<div class="post-metadata">

**Author:** ![pallav12](https://avatars.discourse-cdn.com/v4/letter/p/34f0e0/32.png) [@pallav12](https://discourse.processing.org/u/pallav12)\
**Post date:** [February 4, 2020, 6:07pm UTC](https://discourse.processing.org/t/development-of-processing-for-android/17510/6 "2020-02-04T18:07:27Z")

</div>

@noel sorry for the late reply… its Oreo 8.1, oppo A3s
