Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up an Android Activity within Titanium

I am attempting to enable Bluetooth on an Android device. I have read to Android documentation and have a pretty good idea of what the process is. I am, however, rather stuck at actually firing off an Activity using the manifest file. This is what I've done so far...

I've developed an Android Module with a couple of classes:

  1. BluetoothModule // extends KrollModule
  2. BluetoothSetup // extends Activity

In BluetoothSetup, the onCreate method looks like:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    connectBluetooth();
}

Also in BluetoothSetup, the connectBluetooth() method looks like:

protected void connectBluetooth(){

        // if statements to check if bluetooth is enabled/avail removed
        Intent intentBluetooth = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);

        startActivityForResult(intentBluetooth, 0); 

    }   

}

Finally, in the module's timodule.xml I've added:

            <activity android:label="@string/app_name" android:name="com.eyesore.bluetooth2.BluetoothSetup">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                </intent-filter>
            </activity>

The module compiles just fine, but does not actually do anything. I fear that I've missed a fundamental step here, but I'm just not sure what it is. Any advice would be greatly appreciated!

like image 592
Garrett Avatar asked Jan 26 '26 15:01

Garrett


1 Answers

Figured this out. Wound up creating a custom per instructions here:

https://wiki.appcelerator.org/display/guides/Maintaining+a+Custom+AndroidManifest.xml

I removed the extra code Titanium drops in the manifest file and it seems to be working.

like image 107
Garrett Avatar answered Jan 28 '26 05:01

Garrett