Autostart html5 video using android 4 browser

It seems that Android 4+ changed the requirements for the play() method to require user interaction. If you trigger play() from within a user event handler (eg. touchstart or mousedown), then you can play the video as long as you run it inside the same event loop. This means that you shouldn’t use async triggers … Read more

How to make the navigation bar transparent

I have taken this from the change log for Android KitKat (4.4): Translucent system bars You can now make the system bars partially translucent with new themes, Theme.Holo.NoActionBar.TranslucentDecor and Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent system bars, your layout will fill the area behind the system bars, so you must also enable fitsSystemWindows for the portion of … Read more

Why is FusedLocationApi.getLastLocation null

The fused location provider will only maintain background location if at least one client is connected to it. Now just turning on the location service will not guarantee storing the last known location. Once the first client connects, it will immediately try to get a location. If your activity is the first client to connect … Read more

Android detect usb storage for kitkat (4.4)

Please post code for your BroadcastReceiver and AndroidManifest.xml. Manifest should look something like <application> <!— … —> <receiver android:name=”.UsbBroadcastReceiver” android:exported=”true” android:enabled=”true” > <intent-filter> <action android:name=”android.intent.action.MEDIA_MOUNTED” /> <action android:name=”android.intent.action.MEDIA_UNMOUNTED” /> <data android:scheme=”file” /> </intent-filter> </receiver> </application> Note the data tag, it’s often overlooked. In your onReceive implementation the URI to root of mount can be obtained … Read more

In android 4.4, swiping app out of recent tasks permanently kills application with its service . Any idea why?

Got it. Its a bug in 4.4. I tried this and it worked perfectly fine(its a dirty workout though). Just override this method -: public void onTaskRemoved(Intent rootIntent) { Log.e(“FLAGX : “, ServiceInfo.FLAG_STOP_WITH_TASK + “”); Intent restartServiceIntent = new Intent(getApplicationContext(), this.getClass()); restartServiceIntent.setPackage(getPackageName()); PendingIntent restartServicePendingIntent = PendingIntent.getService( getApplicationContext(), 1, restartServiceIntent, PendingIntent.FLAG_ONE_SHOT); AlarmManager alarmService = (AlarmManager) getApplicationContext() … Read more