Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 732
cja Avatar asked Feb 26 '14 19:02

cja


People also ask

What is the use of implicit intent in android?

An implicit intent specifies an action that can invoke any app on the device able to perform the action. Using an implicit intent is useful when your app cannot perform the action, but other apps probably can and you'd like the user to pick which app to use.

What are app intents?

An intent allows you to start an activity in another app by describing a simple action you'd like to perform (such as "view a map" or "take a picture") in an Intent object.

What are intents in Android system?

Intents are used to signal to the Android system that a certain event has occurred. Intents often describe the action which should be performed and provide data upon which such an action should be done. For example, your application can start a browser component for a certain URL via an intent.

How do I open an app with intent?

It is possible to start an app's activity by using Intent. setClassName according to the docs. To open it outside the current app, add this flag before starting the intent.


2 Answers

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.

like image 65
Shashi Avatar answered Nov 04 '22 00:11

Shashi


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.

like image 21
Jorge Gil Avatar answered Nov 03 '22 23:11

Jorge Gil