AirBlue Sharing API

This post is also available in: 英语

If you want to send files via AirBlue Sharing from your application, you have these choices:

1. OpenIn:

When you present the OpenIn menu, and the file type is supported by AirBlue Sharing, when you select AirBlue Sharing, it launches, show the device selection list and then redirect to your application. (The file will be copied from your application to AirBlue Sharing.)

2. obex://file-name-to-send

You can also use the obex:// URL scheme to, this will run AirBlue Sharing and start sending this file and redirect back to your application.

3. Through AirBlue Sharing API.

With AirBlue Sharing API, you can present the device selection window just in your application

@interface ObexPushClient : NSObject
/*
    The shared instance, you can usually get this instance by:
    #include <dlfcn.h>
    if (dlopen("/usr/lib/libblued-obex.dylib", RTLD_DEFAULT) == NULL) {
        // AirBlue Sharing is not installed
        return;
    }
    Class $ObexPushClient = objc_getClass("ObexPushClient");
    id inst = [$ObexPushClient sharedClient];
 */

 

+ (ObexPushClient*) sharedClient;

 

/*
    send a single file.
    name: file name, readable, will be shown/saved on remote device
    path: full filesystem path of the file to be sent
    mime: mimetype of the file, can be specified as nil
 */
- (BOOL) sendFile:(NSString*)name atPath:(NSString*)path ofType:(NSString*)mime;

 

/*
 deleteSend: the file will be deleted when error or sent
 */
- (BOOL) sendFile:(NSString*)name atPath:(NSString*)path ofType:(NSString*)mime deleteSent:(BOOL)yes;

 

/*
 multiple file sending interface, prepare for sending
 */
- (void) prepareSend;

 

/*
 multiple file sending interface, prepare for sending, delete files when error/sent
 */
- (void) prepareSendAndDelete;

 

/*
 append a file to be sent
 name: file name, readable, will be shown/saved on remote device
 path: full filesystem path of the file to be sent
 mime: mimetype of the file, can be specified as nil
 */
- (void) appendFile:(NSString*)name atPath:(NSString*)path ofType:(NSString*)mime;

 

/*
 start sending now, the device select windows will show
 */
- (void) doSend;
 @end

 

anyShare分享到:
        
eric

About The Author

No Comments