这是我的应用引起的警告吗? -“带有startService的隐式意图是不安全的"; [英] Is this warning caused by my app? - "Implicit intents with startService are not safe"

查看:120
本文介绍了这是我的应用引起的警告吗? -“带有startService的隐式意图是不安全的";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发过程中,我在Logcat中收到此警告.是我的应用造成的吗?

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

16699-16699/tld.me.myapp.debug W/ContextImpl:隐式意图 使用startService并不安全:意图{ 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

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.

推荐答案

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

意图解决方案

您将使用两种主要的意图形式.

There are two primary forms of intents you will use.

显式意图指定了一个组件(通过setComponent(ComponentName)或setClass(Context,Class)),该组件提供了要运行的确切类.通常,这些信息将不包含任何其他信息,仅是应用程序在用户与应用程序进行交互时启动其具有的各种内部活动的一种方式. 隐式意图没有指定组件.相反,它们必须包括足够的信息以使系统确定为此目的最佳运行的可用组件. 当使用隐式意图时,给定这样的任意意图,我们需要知道如何处理它.这由Intent解析过程来处理,该过程将Intent映射到可以处理它的Activity,BroadcastReceiver或Service(有时是两个或多个Activity/Receiver).

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.

这篇关于这是我的应用引起的警告吗? -“带有startService的隐式意图是不安全的";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆