APDE USB / OTG communication

versions of what?
libraries?

the Procedure is old

let me make simple project if it worked i am going to try APDE i need 1 or 2 days

2 Likes

Sure.
That would be great.

A working solution, with a bit of work from you, is already in your post:

This was my starting point and I have shared this link with you before:
Impossible to grant access to USB port through AndroidManifest · Issue #84 · Calsign/APDE · GitHub

Calsign states:

Yes technically you can achieve what you want by modifying the manifest template, but this isn’t really a solution for most users because it means that every sketch built with the modified version of APDE will have the uses-feature tag.

@glv steps to modify the manifest template:

  1. Download the APDE.apk (APDE v0.5.1 Alpha) from:
    GitHub - Calsign/APDE: Source code for APDE: Create and run Processing sketches on an Android device.

  2. Use an APK Editor of your choice (I used APK Easy Tools on my PC) and modify this file:
    \assets\templates\AppManifest.xml.tmpl

To this:

Modified AppManifest.xml.tmpl
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package=""
          android:versionCode="1"
          android:versionName="1.0"> 

    <!-- Added -->
    <uses-feature android:name="android.hardware.usb.host"/>
					
    <uses-sdk android:minSdkVersion="@@min_sdk@@" android:targetSdkVersion="@@target_sdk@@" />
    <application android:label=""
                 android:icon="@drawable/icon">
        <activity android:name=".MainActivity"
                  android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
						
            <!-- Added -->
            <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
            </intent-filter>
            <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" 
						android:resource="@xml/device_filter"/>						
						
        </activity> 
    </application>
</manifest>
  1. Install the modified APDE.APK on the Android phone.

  2. Add this directory and file /res/xml/device_filter.xml to the sketch folder.
    This device_filter.xml (there are others) worked for me:
    processing-android-serial/src/main/examples/PulseSensor11574/res/xml/device_filter.xml at master · inventit/processing-android-serial · GitHub

  3. APDE Preview mode did not work (some more modifications would be necessary) however I created an App and this worked.

This works for my needs.

I have tested it and able to reproduce the results. :)

I wrote a very simple sketch on the Arduino to count and send to serial port and received this with my app (used the modified APDE to make this) on the Android phone.

I now have serial communication between my Android Phone (Version 9) and Arduino Mega 2560 R3 (using an OTG cable) with an app created with the modified APDE.

I have not worked with the APDE or an APK editor before so this was a worthwhile adventure and I now have some new tools, experience and skills for my technical resume.

Be methodical, meticulous and document while working on this.

The rest is up to you. Enjoy the journey!

UPDATE 2021-05-21
I used the AndroidSerial for Processing library latest release 0.2.0 available here:

:)

3 Likes

i have said the you are able to solve it … on android mode the steps much easier and more simple

1 Like

@ZENAR57 the Procedure of @glv is slimier for what i did in android mode it should work with you simply after you modify APDE make this folders inside your sketch folder /res/xml/ then add
device_filter.xml file

1 Like

Sure.
That woul bi great.
As soon as I have a free minute, I’ll do it right away.

This seems to be the simplest solution. now the main thing is that it would work out normally. I’ll try at home for the night.

+

5.1alpha on my phone doesn’t want to download any zip library, even before modification. can it be done with 5.2 betta. Why only 5.1alpha?

@ZENAR57
@paulgoux

I designed a temperature measurement program on the Arduino and it works on the Android over OTG

i finish Android mode now next step APDE mode

2 Likes

Screenshot_2021-05-18-04-24-13-038

2 Likes

OK.
And what is your Arduino sensor that measures temperatures up to 400 ° C?

1 Like

Some versions of APDE do not load compressed zip libraries, and some do well on the same smartphone.

they got a new library 4 days ago. only it is not compressed, there is no zip file.

Hello @ZENAR57,

My exploration of this ended with this topic:
APDE USB / OTG communication - #24 by glv

I am not using APDE and Android phone as my development environment at this time.

If I am so inclined I will add to the topic.

Enjoy the exploration and the journey!

I hope you reach your destination.

:)

2 Likes

Thank you so much for your input!

2 Likes

Thank you.
you have done a lot.
your contribution was very great. Always welcome to this topic.

1 Like

2

Source code(zip)

Source code(tar.gz)

1 Like

Is there a jar version of this?

1 Like

here it is as a jar, also the eclipse files should you wish to amend the build.

2 Likes