Skip to content

Commit

Permalink
#369 fhem uri integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Klass committed Apr 6, 2013
1 parent 50ad643 commit 45598ea
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/AndroidManifest.xml
Expand Up @@ -218,5 +218,18 @@
<action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING"/>
</intent-filter>
</receiver>

<activity
android:name=".activities.FHEMUrlActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>

<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="fhem"/>
</intent-filter>
</activity>
</application>
</manifest>
28 changes: 28 additions & 0 deletions app/src/li/klass/fhem/activities/FHEMUrlActivity.java
@@ -0,0 +1,28 @@
package li.klass.fhem.activities;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import li.klass.fhem.constants.Actions;
import li.klass.fhem.constants.BundleExtraKeys;

public class FHEMUrlActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Uri data = getIntent().getData();
if (data == null) return;
if (data.getHost() == null) return;

String host = data.getHost();

Intent intent = new Intent(Actions.EXECUTE_COMMAND);
intent.putExtra(BundleExtraKeys.COMMAND, host);
startService(intent);


finish();
}
}

0 comments on commit 45598ea

Please sign in to comment.