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

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

mylib.so has text relocations. This is wasting memory and is a security risk. Please fix

This would appear to be a result of two ndk-gcc bugs mentioned at https://code.google.com/p/android/issues/detail?id=23203 and stated there to have been fixed as of ndk-r8c. It would appear that the check for libraries with the issue has been added only recently. Note: please do not edit this post to hide the link URL. It is explicit … Read more

Receive MMS messages in Android KitKat

There’s zero documentation so here’s some info to help. 1) com.google.android.mms.pdu from source. You need the Pdu utils. 2) You get the notification push from byte array extra of the incoming mms broadcast (intent.getByteArrayExtra(“data”)). 3) Parse the notification push into a GenericPdu (new PduParser(rawPdu).parse()). 4) You’ll need TransactionSettings to communicate with the carrier’s wap server. … Read more

How to persist permission in android API 19 (KitKat)?

I believe I’ve solved it. The request intent: Intent intent; if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); }else{ intent = new Intent(Intent.ACTION_GET_CONTENT); } intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setType(“image/*”); startActivityForResult(Intent.createChooser(intent, getResources().getString(R.string.form_pick_photos)), REQUEST_PICK_PHOTO); and onActivityResult … // kitkat fixed (broke) content access; to keep the URIs valid over restarts need to persist access permission if(Build.VERSION.SDK_INT … Read more

How to record screen and take screenshots, using Android API?

First step and the one which Ken White rightly suggested & which you may have already covered is the Example Code provided officially. I have used their API earlier. I agree screenshot is pretty straight forward. But, screen recording is also under similar lines. I will answer your questions in 3 sections and will wrap … Read more

Android KitKat securityException when trying to read from MediaStore

Had the same problem for the last couple of days. Tried a few solutions, but for some reason I was getting permission denial on Uri content provider for some images even when I had the android.permission.MANAGE_DOCUMENTS permission added to my manifest. Here’s a workaround, for the time being: i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, CHOOSE_IMAGE); … Read more