Back to project page C2Framework.
The source code is released under:
Apache License
If you think the Android project C2Framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package gaia.c2.content.android; //from w w w .j av a 2 s .c o m import android.content.Context; import android.os.Bundle; import gaia.c2.content.C2ContentProvider; import gaia.c2.content.QueryHandler; import gaia.c2.content.android.model.Vibration; /** * Created by kmr on 4/12/14. */ public class VibrationContentProvider extends C2ContentProvider { public static final String VIBRATION_TIME = "time"; public static final String VIBRATION_PATTERN = "pattern"; private static final long DEFAULT_VIBRATION_TIME = 250L; public VibrationContentProvider(Context androidParentContext) { super(androidParentContext); } @Override public String getMimeType() { return Vibration.MIME_TYPE; } @Override public String getAuthority() { return "android.vibrator"; } @Override public void onCreate() { super.onCreate(); on("vibrate", new QueryHandler() { @Override public void handle(String method, Bundle parameters) throws Exception { Vibration vb = new Vibration(new long[]{0L, parameters.getLong(VIBRATION_TIME, DEFAULT_VIBRATION_TIME)}); broadcast(vb); } }); on("vibrate-pattern", new QueryHandler() { @Override public void handle(String method, Bundle parameters) throws Exception { Vibration vb = new Vibration(parameters.getLongArray(VIBRATION_PATTERN)); broadcast(vb); } }); } @Override public void onDestroy() { super.onDestroy(); } }