FAU Android

FAU's local android experts!

To launch an app made using Processing from an app made using Eclipse, for this method we first need to export our processing application as shown in method 1.  From here we need to import it into our Eclipse environment.  Add a new java file for your broadcast receiver called “MyBroadcastReceiver.java”.  See below:

In the MyBroadcastReceiver.java file put the following code:

package processing.test.collect_accelerometer_data;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class MyBroadcastReceiver extends BroadcastReceiver {
    public MyBroadcastReceiver() {

    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals("edu.fau.android.mybroadcast")) {
	        Intent i = new Intent(context, collect_accelerometer_data.class);

The name of the package and Activity to launch will vary, but for the most part this code can be used in any other application.  This code uses the broadcast receiver’s onReceive method to launch a specific Activity when it receives a broadcast with the action “edu.fau.android.mybroadcast”.  The broadcast receiver cannot be used in the application until it is registered in the AndroidManifest file. Within the application tags of the file place the following xml code:

<receiver android:name="MyBroadcastReceiver">
            <action android:name="edu.fau.android.mybroadcast" />

This code filters intents of a specific action and calls the appropriate BroadcastReceiver’s onReceive method.

The receiver part is now complete.  If you would like to send a broadcast to the receiver use the following code in a button click method or similar method:

public void launchApp(View v){
	Intent intent = new Intent();

Download the source code at the bottom of this post.


Comments are closed.