Is this warning caused by my app? - "Implicit intents with startService are not safe"
Asked Answered
L

3

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.

Langobard answered 26/2, 2014 at 19:4 Comment(9)
dont worry. its just from google play services.Myel
@Myel can you explain?Langobard
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.Myel
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.Myel
See also #21873886Nickola
#21873886Treharne
For the right answer please refer o this post: #21873886Parlormaid
I had a comment here with several up votes. What happened to it?Langobard
"Don't worry, I can't explain, it's just something!?"Langobard
J
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.

Johm answered 29/3, 2014 at 13:25 Comment(0)
L
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.

Laceration answered 5/12, 2014 at 4:16 Comment(0)
R
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>
Riancho answered 26/4, 2014 at 8:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.