Behnam
Behnam

Reputation: 6620

How to determine when a bluetooth file is received?

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 order to find out when a file has been received via Bluetooth?

Also, please tell me if there are other solutions.

Upvotes: 2

Views: 1404

Answers (1)

Tom
Tom

Reputation: 1273

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);

}

Upvotes: 2

Related Questions