16

I get this warning in Logcat while developing. Is it caused by my app?

16699-16699/tld.me.myapp.debug W/ContextImpl﹕ Implicit intents with startService are not safe: Intent { act=com.google.android.location.internal.GoogleLocationManagerService.START } android.content.ContextWrapper.bindService:517 com.google.android.gms.internal.v.a:-1 com.google.android.gms.internal.u.connect:-1

I can't see where I could be causing this in my code.

cja
  • 9,512
  • 21
  • 75
  • 129
  • dont worry. its just from google play services. – hepizoj Mar 28 '14 at 08:52
  • @hepizoj can you explain? – cja Mar 28 '14 at 08:56
  • cant explain what is really happening. i also recently got it after the i updated google play services. its something internal to playServices. nothing to worry. – hepizoj Mar 28 '14 at 09:01
  • lol! Your obviously using google map v2 or gms location manager. So if its still working, don't bother about it. Don't try to fix whats not broken. – hepizoj Mar 28 '14 at 09:18
  • See also http://stackoverflow.com/questions/21873386/why-is-using-an-implicit-intent-to-start-a-service-not-safe – domen Jun 04 '14 at 09:45
  • http://stackoverflow.com/questions/21873386/why-is-using-an-implicit-intent-to-start-a-service-not-safe – Vitaliy A Aug 17 '14 at 13:20
  • 2
    For the right answer please refer o this post: http://stackoverflow.com/questions/21873386/why-is-using-an-implicit-intent-to-start-a-service-not-safe – German Aug 20 '14 at 00:58
  • I had a comment here with several up votes. What happened to it? – cja Sep 23 '15 at 07:18
  • "Don't worry, I can't explain, it's just something!?" – cja Oct 21 '15 at 09:02

3 Answers3

9

http://developer.android.com/reference/android/content/Intent.html

Intent Resolution

There are two primary forms of intents you will use.

Explicit Intents have specified a component (via setComponent(ComponentName) or setClass(Context, Class)), which provides the exact class to be run. Often these will not include any other information, simply being a way for an application to launch various internal activities it has as the user interacts with the application. Implicit Intents have not specified a component; instead, they must include enough information for the system to determine which of the available components is best to run for that intent. When using implicit intents, given such an arbitrary intent we need to know what to do with it. This is handled by the process of Intent resolution, which maps an Intent to an Activity, BroadcastReceiver, or Service (or sometimes two or more activities/receivers) that can handle it.

May be its saying to mention the component explicitly.

Shashi
  • 101
  • 4
1

I faced exactly the same problem and it seems to be that in the Google Play Services Library, they missed to put android:exported="true" in their <service> declaration.

Before Android 5.0, it was allowed to start services with implicit intents, but now it's not possible, and instead of having a warning, you will have an Exception.

They need to fix their stuff.

Jorge Gil
  • 4,265
  • 5
  • 38
  • 57
0

While setting the filters in the service that you are trying to access, you have to make the exported:"false" to exported:"true". Such as below:

<service
        android:name=".MyService"
        android:exported="true" >
        <intent-filter >
            <action android:name="com.pluralsight.intentrelatedstuffs.action.LOG_TIME"></action>
        </intent-filter>
    </service>