1

在我的应用程序中,我想从 Play 商店下载另一个应用程序,下载完成后,我想检查该应用程序的引用。

在清单中我的代码下方

<receiver
        android:name="com.example.demornd.Receiver"
        android:exported="true" >
        <intent-filter>
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>

             </intent-filter>
    </receiver>

在我的活动中

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + appPackageName + "&referrer="
                + "hello"))); 

和我的接收器

public class Receiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent arg1) {
    Bundle extras = arg1.getExtras();
    String referrerString = extras.getString("url");
    Log.w("TEST", "Referrer is: " + referrerString);
    Toast.makeText(context, "Application Download Sucessfully", Toast.LENGTH_LONG).show();
}

}

但我的广播永远不会被调用。请帮忙!如何解决这个问题呢

提前致谢。

4

0 回答 0