我在清单中注册的广播接收器:
I have a broadcast receiver registered in Manifest:
<application ...>
<receiver android:name="com.some.pkg.NewAppReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
</intent-filter>
</receiver>
</appcication>
和接收器:
public class NewAppReceiver extends BroadcastReceiver {
private static final String TAG = "NewAppReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "Intent: " + intent.getAction());
}
}
和接收没事的时候我安装 APK 手动或从 Android Market的。为什么呢?
And nothing is received when I install APK manually or from the Android Market. Why?
你运行一个包含此的BroadcastReceiver安装其他应用程序之前,应用程序?
Did you run the app that contains this broadcastReceiver before installing the other apps?
开始在一些API版本,broadcastReceivers不会直到你执行应用程序的工作。把活动并执行它。
Starting at some API version, broadcastReceivers will not work till you execute the app. Put an activity and execute it.
另外,不要忘记添加以下到BroadcastReceiver的:
Also , don't forget to add the following into the broadcastReceiver:
<data android:scheme="package" />
上一篇:onAnimationEnd是没有得到所谓的,onAnimationStart工作正常正常、工作、onAnimationEnd、onAnimationStart
下一篇:如何解决Eclipse CDT的错误&QUOT;功能“ISDIGIT”无法解析&QUOT;与Android NDK?如何解决、错误、功能、CDT