Volume change listener?

Check out registerMediaButtonEventReceiver(ComponentName broadcastReceiver); Define a BroadcastReceiver that handles ACTION_MEDIA_BUTTON. The recieved intent includes a single extra field, EXTRA_KEY_EVENT, containing the key event that caused the broadcast. You can use this key event to get which key was pressed. EDIT: This is just a sample code. syntax errors may be there. // in onCreate of … Read more

AngularJS Load Data from Service

I think this should solve your problem app.factory(‘nukeService’, function($rootScope, $http) { var nukeService = {}; nukeService.data = {}; //Gets the list of nuclear weapons nukeService.getNukes = function() { $http.get(‘nukes/nukes.json’) .success(function(data) { nukeService.data.nukes = data; }); return nukeService.data; }; return nukeService; }); function NavigationCtrl($scope, $http, nukeService){ $scope.data = nukeService.getNukes(); //then refer to nukes list as `data.nukes` … Read more

Android service onCreate is called multiple times without calling onDestroy

I had the same problem when my service used the same process with activities(default). but no more problems when I made my service use another process. I edited my AndroidManifest.xml like below… (added android:process attribute) <service android:name=”kr.co.pkbio.binoo.CacheFileManagerService” android:process=”:kr.co.pkbio.binoo.service”/> <service android:name=”kr.co.pkbio.binoo.ActivityStackManagerService” android:process=”:kr.co.pkbio.binoo.service”/> see http://developer.android.com/guide/topics/manifest/service-element.html for information.

How to keep Bluetooth connection background?

Yes, I found a working solution for running Bluetooth background in Android. Below is the code I have used in my android app. public class BluetoothServices extends Service { private BluetoothAdapter mBluetoothAdapter; public static final String B_DEVICE = “MY DEVICE”; public static final String B_UUID = “00001101-0000-1000-8000-00805f9b34fb”; // 00000000-0000-1000-8000-00805f9b34fb public static final int STATE_NONE = … Read more

Getting the Application Context

The easiest way to get the application context is: Create a class App that extends android.app.Application public class App extends Application { public static Context context; @Override public void onCreate() { super.onCreate(); context = getApplicationContext(); } } Modify your AndroidManifest.xml ‘s <application> tag to have the attribute android:name=”your.package.name.App”. Any time you need the application context, … Read more

.Net’s Directory Services throws a strange exception

I had this problem too using IIS Express and VS 2010. What fixed it for me was a comment on another thread. Validate a username and password against Active Directory? but i’ll save you the click and search… 🙂 Just add ContextOpations.Negotiate to you Validate Credentials call like below. bool valid = context.ValidateCredentials(user, pass, ***ContextOptions.Negotiate***); … Read more