Accept Google Now voice commands
This commit is contained in:
@@ -15,9 +15,12 @@
|
||||
android:launchMode="singleInstance">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SET_TIMER"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<uses-library
|
||||
@@ -27,4 +30,5 @@
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
|
||||
</manifest>
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.provider.AlarmClock;
|
||||
import android.support.wearable.activity.WearableActivity;
|
||||
import android.support.wearable.view.WatchViewStub;
|
||||
import android.util.Log;
|
||||
@@ -67,6 +68,22 @@ public class MainActivity extends WearableActivity
|
||||
refreshViews();
|
||||
}
|
||||
});
|
||||
|
||||
executeIntent();
|
||||
}
|
||||
|
||||
private void executeIntent()
|
||||
{
|
||||
Intent intent = getIntent();
|
||||
|
||||
if(intent == null) return;
|
||||
if(!intent.getAction().equals(AlarmClock.ACTION_SET_TIMER)) return;
|
||||
|
||||
Integer seconds = intent.getIntExtra(AlarmClock.EXTRA_LENGTH, -1);
|
||||
if(seconds < 0) return;
|
||||
|
||||
stimer.setTotalTime(seconds * 1000);
|
||||
stimer.resume();
|
||||
}
|
||||
|
||||
private void startFixedRateTimer()
|
||||
|
||||
Reference in New Issue
Block a user