How to determine when a bluetooth file is received?

后端 未结 1 580
傲寒
傲寒 2021-01-15 01:36

In my app, I need to edit an bluetooth-transferred file just after it is received.

Exactly what Intent do I have to listen to with my BroadcastReceiver, in o

1条回答
  •  广开言路
    2021-01-15 02:09

    If the user gets a file via android OS, it's via the download manager. in that case u should register DownloadManager.ACTION_DOWNLOAD_COMPLETE

    private void registerBroadcastReceiver() {
        broadCastReceiver = new BroadcastReceiver() {
            public void onReceive(Context context, Intent intent) {
                String action = intent.getAction();
                if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
                    //your code here
                }
            }
        };
        IntentFilter filter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
        registerReceiver(broadCastReceiver, filter);
    
    }
    

    0 讨论(0)
提交回复
热议问题