Can’t start activity from BroadcastReceiver on android 10

Android 10’s restriction on background activity starts was announced about six months ago. You can read more about it in the documentation. Use a high-priority notification, with an associated full-screen Intent, instead. See the documentation. This sample app demonstrates this, by using WorkManager to trigger a background event needing to alert the user. There, I … Read more

StartActivityForResults always returns RESULT_CANCELLED for Intent.ACTION_SEND

startActivityForResult() only works with activities that are intended to be called that way. If the activity you are calling doesn’t explicitly return a result, you will get the default result RESULT_CANCELED. Obviously ACTION_SEND is not designed to be called this way. The documentation for ACTION_SEND indicates that is generates no output (ie: generates no result). … Read more

java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode

You get this exception only in android.support.v4.app.FragmentActivity and not when you use android.app.Activity. startActivityForResult() in FragmentActivity requires the requestCode to be of 16 bits, meaning the range is from 0 to 65535. Also, validateRequestPermissionsRequestCode in FragmentActivity requires requestCode to be of 16 bits, meaning the range is from 0 to 65535. For more info(if you … Read more