Programming Tips - Android: "Implicit intents with startService are not safe" fix

Date: 2021apr1 Language: Java OS: Android Q. Android: "Implicit intents with startService are not safe" fix This is a warning in the logcat. A. Change:
Intent intent = new Intent("com.example.myapp.Mycls"); ... ComponentName cn = context.startService(intent);
To:
Intent intent = new Intent("com.example.myapp.Mycls"); intent.setComponent(new ComponentName("com.example.myapp", "com.example.myapp.MyService")); ... ComponentName cn = context.startService(intent);