Giter Site home page Giter Site logo

jcash / defold-sharing Goto Github PK

View Code? Open in Web Editor NEW

This project forked from britzl/defold-sharing

0.0 2.0 0.0 518 KB

Defold native extension to share data from a Defold application using native dialogs

License: MIT License

C++ 40.43% Java 22.49% Objective-C++ 15.68% JavaScript 21.40%

defold-sharing's Introduction

Defold Sharing

Defold native extension to share application data using native sharing dialogs.

System requirements

The extension currently supports OSX, iOS, Android and HTML5. Browser compatibility

Installation

You can use the Sharing extension in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

https://github.com/britzl/defold-sharing/archive/master.zip

Or point to the ZIP file of a specific release.

Starting Defold 1.2.165 the Android dependencies are resolved using the build.gradle file.

Usage

The share.* namespace will be nil if the share extension isn't supported (see System requirements above).

share.text(text)

Share text using a native sharing dialog.

PARAMETERS

  • text (string) - The text to share

share.image(bytes, [text], [file_name])

Share an image (with optional text) using a native sharing dialog. Supported formats depend on the platform:

  • Android - The image format must be supported by BitmapFactory.decodeByteArray(). On Android the image will first be stored locally as a file and then shared using a FileProvider.
  • iOS and macOS - The image format must be supported by UIImage.initWithData.
  • HTML5 - Either DataURI or any image format supported by the underlying platform.

PARAMETERS

  • bytes (string) - The image bytes to share
  • text (string) - Optional text to share
  • file_name (string) - Optional Only for HTML5 image name. Default "file.png"

share.file(path, [text], [options])

Share a file (with optional text) using a native sharing dialog. On Android the file will first be copied to a predefined location and then shared using a FileProvider. Files are shared with their original filename and extension. This will allow iOS to offer different kinds of applications depending on the shared content.

PARAMETERS

  • path (string) - Full path to the file to share. For HTML5: specify the name of the file. Default file.txt.

  • text (string) - Optional text to share. For HTML5: specify the data that should be in the file.

  • options (table) - Optional Only for HTML5.

    • type (string) - data type. Default "text/plain"
    • text (string) - text to be shared
    • title (string) - title to be shared. May be ignored by the target
    • url (string) - URL to be shared

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.