Resources and layout direction rendered incorrectly only on Android 8.0 and above

The updateConfiguration() method was deprecated Now we need to use createConfigurationContext() I have managed this way create a new class ContextWrapper import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.os.Build; import android.os.LocaleList; import java.util.Locale; public class ContextWrapper extends android.content.ContextWrapper { public ContextWrapper(Context base) { super(base); } public static ContextWrapper wrap(Context context, Locale newLocale) { Resources res … Read more

Broadcast receiver not working in android oreo

Broadcast Limitations If an app registers to receive broadcasts, the app’s receiver consumes resources every time the broadcast is sent. This can cause problems if too many apps register to receive broadcasts based on system events; a system event that triggers a broadcast can cause all of those apps to consume resources in rapid succession, … Read more

Notifications fail to display in Android Oreo (API 26)

Per the comments on this Google+ post: those [warnings] are currently expected when using NotificationCompat on Android O devices (NotificationCompat always calls setSound() even if you never pass in custom sound). until the Support Library changes their code to use the AudioAttributes version of setSound, you’ll always get that warning. Therefore there’s nothing that you … Read more

Unable to save image file in android oreo update. How to do it?

There is, in fact, a slight, subtle change in Permissions for apps running on and targeting API 26. Previously, apps were automatically granted all permissions in a given group if at least one permission in that group had been granted by the user. This means that an app that had been granted the READ_EXTERNAL_STORAGE would’ve … Read more

How can I reliably simulate touch events on Android without root (like Automate and Tasker)?

As suggested, the best way to simulate touch events since Nougat (API 24) is by using an accessibility service and the AccessibilityService#dispatchGesture method. Here is how I did to simulate a single tap event. // (x, y) in screen coordinates private static GestureDescription createClick(float x, float y) { // for a single tap a duration … Read more

Detect CONNECTIVITY CHANGE in Android 7 and above when app is killed/in background

Nougat and Above: We have to use JobScheduler and JobService for Connection Changes. All I can divide this into three steps. Register JobScheduler inside activity. Also, Start JobService( Service to handle callbacks from the JobScheduler. Requests scheduled with the JobScheduler ultimately land on this service’s “onStartJob” method.) public class NetworkConnectionActivity extends AppCompatActivity { @Override protected … Read more

Disabling Android O auto-fill service for an application

Currently there is no direct way to disable the autofill for an entire application, since the autofill feature is View specific. You can still try this way and call BaseActivity everywhere. public class BaseActivity extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); disableAutofill(); } @TargetApi(Build.VERSION_CODES.O) private void disableAutofill() { getWindow().getDecorView().setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS); } } You … Read more

tech