Skip to content

urovosamples/ProgrammableKey

Repository files navigation

ProgrammableKey

Sample for Programmable Key Export Programmable key config to sdcard/keys_config.txt.

Intent intentService = new Intent("action.PROGRAMMABLE_KEY_SERVICE"); Intent eintent = new Intent(getExplicitIntent(MainActivity.this,intentService)); eintent.putExtra("programmable",2); startService(eintent);

public static Intent getExplicitIntent(Context context, Intent implicitIntent) { // Retrieve all services that can match the given intent PackageManager pm = context.getPackageManager(); List resolveInfo = pm.queryIntentServices(implicitIntent, 0); // Make sure only one match was found if (resolveInfo == null || resolveInfo.size() != 1) { return null; } // Get component info and create ComponentName ResolveInfo serviceInfo = resolveInfo.get(0); String packageName = serviceInfo.serviceInfo.packageName; String className = serviceInfo.serviceInfo.name; ComponentName component = new ComponentName(packageName, className); // Create a new intent. Use the old one for extras and such reuse Intent explicitIntent = new Intent(implicitIntent); // Set the component to be explicit explicitIntent.setComponent(component); return explicitIntent; } Import Programmable key config from sdcard/keys_config.txt. Intent intentService = new Intent("action.PROGRAMMABLE_KEY_SERVICE"); Intent eintent = new Intent(getExplicitIntent(MainActivity.this,intentService)); eintent.putExtra("programmable",1); startService(eintent);

true VOLUME_DOWN 66 0 VOLUME_UP com.android.chrome 0

About

Sample for Programmable Key

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages