android(未收到ACTION_PACKAGE_ADDED(xperia SO-03D))

壮心未与年俱老,死去犹能作鬼雄。这篇文章主要讲述android:未收到ACTION_PACKAGE_ADDED(xperia SO-03D)相关的知识,希望能为你提供帮助。
安装新应用程序时,我的BroadcastReceiver通过一个简单的过滤器获取包数据:

filter = new IntentFilter(); filter.addAction(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REPLACED); filter.addDataScheme("package"); receiver = new newPackageReceiver(); registerReceiver(receiver, filter); ...public class newPackageReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) {final String info = intent.getData().toString(); ... } }

【android(未收到ACTION_PACKAGE_ADDED(xperia SO-03D))】用大多数设备调用BroadcastReceiver ...但是,使用这个device(仅限日语,抱歉),onReceive永远不会被调用。
  • 型号:sony SO-03D
  • android-version:4.0.4
没有可用于设备的更新....任何想法?
答案也许这有帮助。尝试将接收器添加到清单中。
< receiver android:name=".YourReceiver"> < intent-filter> < action android:name="android.intent.action.PACKAGE_INSTALL" /> < action android:name="android.intent.action.PACKAGE_ADDED" /> < data android:scheme="package"/> < /intent-filter> < /receiver>

在YourReceiver类中:
public class YourReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String act = intent.getAction(); if (Intent.ACTION_PACKAGE_ADDED.equals(act) || Intent.ACTION_PACKAGE_REMOVED.equals(act)) { //Do what you want } }

我希望这会有所帮助,但似乎问题在于这个设备的rom。

    推荐阅读