安卓下载管理器管理器

由网友(笑我孤陋)分享简介:我要实现我想要的应用程序的下载后搭上 android.intent.action.DOWNLOAD_COMPLETED 从Android Market应用程序,即意图的解决方案。 Android市场的应用程序使用默认的下载管理器和下载完成的下载管理器发送这样的意图,但我一直没能捕捉到它,我也跟着的本教程并请参照这来就如...

我要实现我想要的应用程序的下载后搭上 android.intent.action.DOWNLOAD_COMPLETED 从Android Market应用程序,即意图的解决方案。 Android市场的应用程序使用默认的下载管理器和下载完成的下载管理器发送这样的意图,但我一直没能捕捉到它,我也跟着的本教程并请参照这来就如何市场的应用程序使用的下载管理器以及有关下载管理器的更多信息,请参阅的这个。请不要给我建议的方式来捕捉那些意图。

修改 这是我使用了我的广播Reciever

什么

 <使用-权限的Andr​​oid:名称=android.permission.ACCESS_DOWNLOAD_MANAGER>
< /使用-许可>


<应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME>
    <接收器
        机器人:名称=。DownloadReceiver
        机器人:权限=android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS
        机器人:出口=真正的>

         <意向滤光器>
            <作用
                机器人:名称=android.intent.action.DOWNLOAD_COMPLETED>
            < /作用>
         &所述; /意图滤光器>
     < /接收器>
  < /用途>
 

解决方案 安卓文件管理器 安卓软件安卓文件管理器下载 安卓文件管理器V1.8安卓版下载V1.8 2265安卓网

您已经得到了一切权利,除非在意图过滤器的操作的名称。注意 DOWNLOAD_COMPLETE 而不是 DOWNLOAD_COMPLETED

 <接收器
        机器人:名称=。DownloadReceiver
        机器人:出口=真
        机器人:图标=@可绘制/ download_icon>
        <意向滤光器>
            <作用机器人:名称=android.intent.action.DOWNLOAD_COMPLETE/>
         &所述; /意图滤光器>
     < /接收器>
 

这为我工作。你并不需要注册在code接收器,这会听,即使你的应用程序没有运行。

I want to implement a solution where I want to catch the android.intent.action.DOWNLOAD_COMPLETED intents from the Android Market App i.e after the download of the app. The android Market app uses the default Download Manager and the download manager on the completion of the download sends such an intent, however I have not been able to capture it,I followed this tutorial and please refer to this to have more details on how market app uses Download Manager and for more information on Download Manager refer to this. Please do suggest me a way to catch those intents.

EDIT This is what I am using for my Broadcast Reciever

<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER">
</uses-permission>


<application android:icon="@drawable/icon" android:label="@string/app_name">
    <receiver 
        android:name=".DownloadReceiver"
        android:permission="android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS"
        android:exported="true">

         <intent-filter>
            <action
                android:name="android.intent.action.DOWNLOAD_COMPLETED">
            </action>
         </intent-filter>
     </receiver>
  </application>

解决方案

You've got everything right except the name of the action in the intent filter. Note the DOWNLOAD_COMPLETE instead of DOWNLOAD_COMPLETED

    <receiver 
        android:name=".DownloadReceiver"
        android:exported="true"
        android:icon="@drawable/download_icon" >
        <intent-filter>
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
         </intent-filter>
     </receiver>        

This worked for me. You do not need to register the receiver in code, this will listen even when your app isn't running.

阅读全文

相关推荐

最新文章