Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all 941 articles
Browse latest View live

Change version code of Android App using export signed package

$
0
0

Hey how is it going?

I have just released an app at play store but I forgot to do one thing, now when I try to send the signed aligned apk file that processing creates using file->Export Signed Package I get a message from google play saying

Upload failed You need to use a different version code for your APK because you already have one with version code 1.

how do I change version code to be able to post?

Thanks in advance!


Android image blob detection using blobscanner and ketai

$
0
0

I am trying to build an app that does blog detection using blobscanner and ketai libraries.

import ketai.camera.*;
import blobscanner.*;
KetaiCamera cam;
PImage img;
Detector bd;
int totalblobs=0;
void setup() {
  orientation(LANDSCAPE);
  imageMode(CENTER);
  textSize(45);
  bd = new Detector( this, 235 );
}

void draw() {

  if(cam != null && cam.isStarted()){

    image(cam, width/2, height/2, width, height);
    cam.savePhoto();
  }
  else
    {
      background(128);
      text("Waiting for camera....touch to activate", 100, height/2);
    }
    cam.filter(THRESHOLD);
    bd.imageFindBlobs(cam);
    totalblobs=bd.getBlobsNumber();
    if(totalblobs >=10 )
    {
      print("Photo captured");
    }
    delay(2000);

}

void onCameraPreviewEvent()
{
  cam.read();
}

// start/stop camera preview by tapping the screen
void mousePressed()
{
  //HACK: Instantiate camera once we are in the sketch itself
  if(cam == null)
      cam = new KetaiCamera(this, 640, 480, 24);

  if (cam.isStarted())
  {
    cam.stop();
  }
  else
    cam.start();
}

void exit()
{
  cam.stop();
}

The savePhoto() command doesn't seem to work and whenever I try to launch it, the app crashes. I want the app to take a photo and save it automatically when a certain amount of blobs are detected. I tried testing it on a Nexus 7 running 5.1.1. Any suggestions?

Issues with migrating to P3 in Eclipse

$
0
0

I am migrating my project from P2 to P3 in Eclipse and experiencing a few issues. As such I have a few questions:

1: Is the following still the correct way to declare the MainActivity class?

    public class MainActivity extends PApplet{
    }

2: Eclipse is telling me that the following method is apparently final and so I cannot override it to set the right renderer:

    public String sketchRenderer() {
    return OPENGL;
    }

How, then, do I set the right renderer?

3: Eclipse is telling me:

The method getSharedPreferences(String, int) is undefined for the type MainActivity

for the following snippet:

    SharedPreferences sharedPref = getSharedPreferences("Data",
                    Context.MODE_PRIVATE);

This was not the case for P2. All other methods within MainActivity that worked with P2 that were called like this from MainActivity:

this.method();

give the same error in P3. The error disappears when I modify the code to the following:

        SharedPreferences sharedPref = getActivity().getSharedPreferences("Data",
                Context.MODE_PRIVATE);

Will this solve the issue?

4: Using P2, I was able to override Android's onStart() method using:

@Override
    protected void onStart() {
        super.onStart();
}

This is no lnger possible, since Eclipse is telling me:

Cannot reduce the visibility of the inherited method from PApplet

Changing it to:

@Override
        public void onStart() {
            super.onStart();
    }

solves the issue, but why could I override the method in P2 and not in P3?

Thank you in advance for your answers.

Unreadable 'AndroidManifest.xml' file

$
0
0

Dear developer To read the content of an AndroidManifest.xml file is very difficult, because the whole text is located in only one line $%&@ Pleeeease add some linefeeds when creating the AndroidManifest.xml file!!! Then we all will get a better readable overview and it will be really easier to change some parameters e.g. version !
Thanx in advance... ;-)

getting started with Processing on Android

$
0
0

I have some questions regarding Android and Processing which I hope someone can answer.

  1. Do I have to look at something specific when buying a android tablet, or will about any android tablet do?

  2. Any good recommendations for tablets?

  3. What do you think of processing for android so far?

  4. Any other things I should know?

Android Mode: tutorial or step-by-step summary for getting started

$
0
0

I am running Processing 3.0.1 on a Windows 10 PC and trying to branch out of Java mode to Android mode. I think I installed the Android SDK according to instructions. However, in trying to use either an Android device or the emulator my Android mode IDE shows no available targets under the Sketch/Run in... menu. The Android/Select device menu item shows "no connected devices". I'm not surprised at this since I've done nothing explicit to set up an emulator or feed my Android phone via USB. But I am not having luck finding a simple, basic procedure for operating in Android mode in the forums. Also, no tutorial which, I believe, did exist at one time on www.processing.org/tutorials.

FX2D cannot be resolved to a variable.

$
0
0

The following produces the error mentioned in the title:

void settings(){
  //size(displayWidth, displayHeight, FX2D);
  fullScreen(FX2D);
  smooth();
}

I am using Processing 3.0, Android Mode.

Anybody knows why this error appears?

Ketai Camera settings

$
0
0

I am using Processing 3.0.1 in Android mode with the Ketai 12 library (Samsung S2 Cyanogen KitKat Phone). When trying to get the camera example working, the video preview really looks messed up, colours are wrong and the image is distorted.

Has anyone had a similar problem which got fixed? Tried all types of resolutions and frame rates to no avail.

I tried if(cam.isRGBPreviewSupported) from the reference and this returned false, is there some other type of preview or is this unrelated?

Ketai is awesome, I really need this camera thing to work for porting apps to Android. Here is a screenshot of the problem:

KetaiCameraMess


"Could not create a virtual device for the emulator".

$
0
0

I just did a fresh (today) install of Processing 3.0 (latest download available from processing.org), and installed the Android SDK - Android 6.0 (API 23) and Android 2.3.3 (API 10).

In older versions of Processing for Android which I happily used for a long time, a virtual device was (eventually) created automatically when you ran the emulator the first time. This seems to not happen anymore. Now, if I start with no virtual device, or matter what device profile I do create in the AVD Manager, whenever I try to run a sketch in the emulator, even when I manually start it, I get "Could not create a virtual device for the emulator". Anyone else getting this error? Anyone have a solution?

I read on the old forum that deleting Intel Atom x86 System Image can work, but it didn't.

I am running Windows 7 64-bit. Java version 8 update 60.

onActivityResult, startActivityForResult and SDK API 10 Errors

$
0
0

So, I am trying to learn Android mode thru Scott C's 4 part tutorial. here at http://arduinobasics.blogspot.com/2013/03/arduino-basics-bluetooth-android.html

The problem is when I try to simulate his Android/Processing Sketch 3: BluetoothChecker2 on my phone, I get several errors on the onActivityResult and startActivityForResult.

the function onActivityResult does not exist somehow so it might by a problem with the library and for the startActivityForResult I am having errors on @Override.

I am currently running sketch on Processing 3.0 and API 22 but Scott's settings on that time he made the tutorial was on Processing 2.0 Beta and API 10. The reason why i am running on API 22 is because I cannot seem to target the API 10 SDK even though I have already downloaded it using SDK Manager.

Ubiquitous Application

$
0
0

Hi

Does someone know how to make an Android app that runs continuously in the phone - like the clock for example. I would like to build an app that works silently on the background.

Best

bp

keytool error when running a script in android mode

$
0
0

Hi, I am running processing 3.0b5 with the latest android version. The PC is running linux mint 17.1.

When trying to run a simple script i get the following error when trying to run in the emulator: BUILD FAILED /home/richard/Dev/processing-3.0b5/android-sdk-linux/tools/ant/build.xml:958: The following error occurred while executing this line: /home/richard/Dev/processing-3.0b5/android-sdk-linux/tools/ant/build.xml:969: The following error occurred while executing this line: /home/richard/Dev/processing-3.0b5/android-sdk-linux/tools/ant/build.xml:312: com.android.sdklib.build.ApkCreationException: Failed to create key: Cannot run program "/opt/processing3/java/bin/keytool": error=2, No such file or directory JAVA_HOME is set to: /opt/processing3/java

I have altered the /etc/environment file to point the PATH and JAVA_HOME to the the Java-7-oracle directory: sudo nano /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-7-oracle" JAVA_HOME=/usr/lib/jvm/java-7-oracle

and this seems to have been accepted: ~ $ echo $JAVA_HOME /usr/lib/jvm/java-7-oracle ~ $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-oracle $ which java /usr/bin/java

However i am still getting the error indicating that JAVA_HOME is still set to /opt/processing3/java.

It seems that i am doing something wrong with setting teh environment variables maybe. Does anybody know how to fix this?

Any help is much appreciated.

Cheers.

Android Savefile,Openfile,Writefile processing 3.0.1...THE EASY WAY!!!

$
0
0

im writing a visualiser and need save and load settings here is a quick save file function.

still working on the string save function and open function.

got this from stackoverflow works to save file to Android internal storage SDCARD.

import android.os.Environment; // need this for Environment Android stuff

public void SaveFile() {

try { String filename="visualiser.txt"; String directory = new String(Environment.getExternalStorageDirectory().getAbsolutePath() ); save(directory + "/" + filename); } catch (Exception e) {

} }

just call SaveFile(); or what ever you want to call it... you will need to set sketch permissions to WRITE_EXTERNAL_STORAGE for file io.

anyone know of a simple method to read write load file into a string.

seen a few methods but it seems overly complicated. createbuffer writebuffer etc.

im no expert in android or java so dont ask me how this works. but its sort of easy to follow. ( declare name/find path/savefile/catch error etc).

Problem with Android Keystore Manager

$
0
0

Hello everybody! When i try to export an android signed package and i put the password (the first time) appears in the console:

java.io.IOException: Cannot run program "/home/pedro/Escritorio/processing-3.0/java/bin/keytool": error=2, No existe el archivo o el directorio at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:620) at java.lang.Runtime.exec(Runtime.java:485) at processing.mode.android.AndroidKeyStore.generateKeyStore(AndroidKeyStore.java:59) at processing.mode.android.KeyStoreManager$1.actionPerformed(KeyStoreManager.java:73) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6525) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6290) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2750) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.io.IOException: error=2, No existe el archivo o el directorio at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(UNIXProcess.java:248) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 40 more java.io.IOException: Cannot run program "/home/pedro/Escritorio/processing-3.0/java/bin/keytool": error=2, No existe el archivo o el directorio at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:620) at java.lang.Runtime.exec(Runtime.java:485) at processing.mode.android.AndroidKeyStore.generateKeyStore(AndroidKeyStore.java:59) at processing.mode.android.KeyStoreManager$1.actionPerformed(KeyStoreManager.java:73) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6525) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6290) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) at java.awt.Container.dispatchEventImpl(Container.java:2278) at java.awt.Window.dispatchEventImpl(Window.java:2750) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.io.IOException: error=2, No existe el archivo o el directorio at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.(UNIXProcess.java:248) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 40 more

I just want to generate the APK. That happends on processing 3.0 running on Linux. I tried to install android mode on Windows, but says that an error occurred. Neither with processing 1.5.1 or 2.2.1. I wish you could help me! Thanks! :)

Android mode processing 3.0a9 x64 still wont download

$
0
0

android mode is now listed in modes but still wont work it downloads to tmp folder inside is AndroidMode folder. moved to mode folder but still wont work.

has anybody tested this....


get error "lost connection with device while launching. try again" when tring to lauch the emulator

$
0
0

I have a fresh install of processing (3.0.1) and have installed api 15, api 22 and api 23 with api 15 as the target sdk. The selected devices menu is blank (as i am trying to run the emulator?). I am running on linux (Mint 17.1 32bit).

When trying to run an empty sketch i got the following error in the console

Emulator process exited with status 1. EmulatorController: Emulator never booted. NOT_RUNNING Error while starting the emulator. (NOT_RUNNING) Shutting down any existing adb server...

Any ideas with this?

Any help is much appreciated.

Cheers.

Ketai Bluetooth dataevent interrupt

$
0
0

Hi, in my project, arduino sends two byte data by osc protocol. In android side, mobile phone get them via bluetooth (ketai-osc) and send to other PC by osc meessage as gateway. Arduino sends very fast but android side lost data and set zero "0" value of float value1 and value2.

Where is my fault? why variables (value1,value2) get 0?

Android Code: `import android.content.Intent; import android.os.Bundle;

import ketai.net.bluetooth.*; import ketai.ui.*; import ketai.net.*; import oscP5.*; import netP5.*;

OscP5 oscP5; NetAddressList myNetAddressList = new NetAddressList(); int myListeningPort = 32000; int myBroadcastPort = 12000; String myConnectPattern = "/server/connect"; String myDisconnectPattern = "/server/disconnect";

KetaiBluetooth bt; String info = ""; KetaiList klist; boolean isConfiguring = true; String UIText; float value1, value2; ArrayList names; String aktar = "Gelen: ";

int xPos = 1;
float height_old = 0; float height_new = 0; int say = 0;

void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState); bt = new KetaiBluetooth(this); }

void onActivityResult(int requestCode, int resultCode, Intent data) { bt.onActivityResult(requestCode, resultCode, data); }

void setup() {

background(0);

oscP5 = new OscP5(this, myListeningPort);

bt.start();

stroke(255); fill(0xff); textSize(32);

if (bt.getDiscoveredDeviceNames().size() > 0) klist = new KetaiList(this, bt.getDiscoveredDeviceNames()); else if (bt.getPairedDeviceNames().size() > 0) klist = new KetaiList(this, bt.getPairedDeviceNames());

bt.discoverDevices();

xPos = (width/4)+1;
height_old = (height/2)-5; stroke(0,0xff,0xff); strokeWeight(5); line(((width/4)-3),0,((width/4)-3),height); line(0,(height/2),width,(height/2));

stroke(0xff, 0, 0); strokeWeight(2);

}

void draw() {

background(0);

value1 = map(value1, 0, 1023, 0, (height/2)-5); height_new = (height/2)-5 - value1; stroke(0); line(xPos,0,xPos,(height/2)-5); stroke(0xff, 0, 0); line(xPos - 1, height_old, xPos, height_new); height_old = height_new;

if (xPos >= width) { xPos = width/4; } else { xPos=xPos + 2; } }

void onBluetoothDataEvent(String who, byte[] data) { KetaiOSCMessage m = new KetaiOSCMessage(data); OscMessage myOscMessage = new OscMessage("");

if (m.isValid()) {

if (m.checkAddrPattern("/sti"))
{
  if (m.checkTypetag("ii"))
  {
    value1= m.get(0).intValue();
    value2 = m.get(1).intValue();
    println("Gelen: "+value1+","+value2);
    myOscMessage.add(value1);
    myOscMessage.add(value2);
    oscP5.send(myOscMessage, myNetAddressList);
  }
}

} }

void onKetaiListSelection(KetaiList klist) { String selection = klist.getSelection(); bt.connectToDeviceByName(selection);

klist = null; }

void oscEvent(OscMessage theOscMessage) {

if (theOscMessage.addrPattern().equals(myConnectPattern)) { connect(theOscMessage.netAddress().address()); } else if (theOscMessage.addrPattern().equals(myDisconnectPattern)) { disconnect(theOscMessage.netAddress().address()); } else { oscP5.send(theOscMessage, myNetAddressList); } }

private void connect(String theIPaddress) { if (!myNetAddressList.contains(theIPaddress, myBroadcastPort)) { myNetAddressList.add(new NetAddress(theIPaddress, myBroadcastPort)); } }

private void disconnect(String theIPaddress) { if (myNetAddressList.contains(theIPaddress, myBroadcastPort)) { myNetAddressList.remove(theIPaddress, myBroadcastPort); } }`

Arduino code: `uint8_t buf[20]; char gelenveri = 0; int val1=512 , val2;

void setup() { Serial.begin(9600); Serial1.begin(115200); pinMode(13,OUTPUT); buf[0] = 47; // / buf[1] = 115; // s buf[2] = 116; // t buf[3] = 105; // i buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[8] = 44; // , buf[9] = 105; // i buf[10] = 105; buf[11] = 0; buf[12] = 0; // ilk veri byte3
buf[13] = 0; // ilk veri byte2
buf[14] = 0; // ilk veri byte1
buf[15] = 0; // ilk veri byte0 buf[16] = 0; // ikinci veri byte3 buf[17] = 0; // ikinci veri byte2 buf[18] = 0; // ikinci veri byte1 buf[19] = 0; // ikinci veri byte0

}

void loop() {

  val1 = analogRead(A0);
  val2 = analogRead(A1);



  buf[14] = val1>>8;
  buf[15] = val1%256;
  buf[18] = val2>>8;
  buf[19] = val2%256;

  Serial1.write(buf, sizeof(buf));


  delay(50);

}`

OUYA Games?

$
0
0

Hello,

I've developed a game mostly in Processing for Android and am almost done with the next one. Has anyone developed for OUYA with Processing?

p5 libraries in processing 3

$
0
0

I was just wonderring - is it possible to use p5 libraries in processing? I would love to use the p5.play library here, and because p5 is strictly based on processing I guess this should be possible. What should i do to make it work?

save to server

$
0
0

Is there a way to send some variables to save them on a server on the web? Even calling a php script on the server?

Viewing all 941 articles
Browse latest View live