Skip to main content

Platform-independent wrapper for platform-dependent APIs

Project description

Plyer

Plyer is a platform-independent api to use features commonly found on various platforms, notably mobile ones, in Python.

coverage Backers on Open Collective Sponsors on Open Collective Continuous Integration with Ubuntu Continuous Integration with OSX Continuous Integration with Windows Deploy to PyPI

How plyer works?

Plyer tries not to reinvent the wheel, and will call for external libraries to implement the api in the easiest way, depending on the current platform.

  • On Android(python-for-android), pyjnius is used
  • On iOS(kivy-ios), pyobjus is used
  • On windows/mac/linux, commonly found libraries and programs will be used

Supported APIs

Platform Android iOS Windows OS X Linux
Accelerometer
Audio recording
Barometer
Battery
Bluetooth
Brightness
Call
Camera (taking picture)
Compass
CPU count
Devicename
Email (open mail client)
Flash
GPS
Gravity
Gyroscope
Humidity
IR Blaster
Keystore
Light
Native file chooser
Notifications
Orientation
Proximity
Screenshot
SMS (send messages)
Spatial Orientation
Speech to text
Storage Path
Temperature
Text to speech
Unique ID
Vibrator
Wifi

Installation

To use on desktop: pip install plyer To use in python-for-android/kivy-ios: add plyer to your requirements if needed.

Support

If you need assistance, you can ask for help on our mailing list:

Discord channel:

Contributing

We love pull requests and discussing novel ideas. Check out our contribution guide and feel free to improve Plyer.

The following mailing list and IRC channel are used exclusively for discussions about developing the Kivy framework and its sister projects:

IRC channel:

  • Server : irc.freenode.net
  • Port : 6667, 6697 (SSL only)
  • Channel : #kivy-dev

License

Plyer is released under the terms of the MIT License. Please refer to the LICENSE file.

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Change Log

2.1.0 (2022-11-12)

Full Changelog

Implemented enhancements:

  • Use xdg-desktop-portal for Notification inside Flatpak #680 (JakobDev)

Closed issues:

  • Exception is thrown on try to play recorded audio clip #713
  • iOS: filechooser - multiple files selection is not working #707
  • Speech to text is not working with api 30 or more #693
  • Traceback (most recent call last): File "jnius/jnius_proxy.pxi", line 50, in jnius.jnius.PythonJavaClass.invoke File "jnius/jnius_proxy.pxi", line 74, in jnius.jnius.PythonJavaClass._invoke NotImplementedError: The method ('onLocationChanged', ('V', ('Ljava/util/List;',))) is not implemented #687
  • Notify on Windows but without archiving notifications #684
  • Notification icon as base64 instead of path #679
  • plyer's last release was ~2 years ago, the number of open PRs is absurd, and the last meaningful commit was months ago #674
  • iOS Filechooser that picks all document types (UIDocumentPickerViewController) #673
  • Python dbus error on Linux when sending notification #658
  • Is that project dead? #650
  • Notification for android not working [ Drawable.icon ] #647
  • audio don't work on android #644
  • Unittests are failing on new clone #637
  • Proposing a PR to fix a few small typos #622
  • Remove python2 mentions from setup.py #608
  • vibrator on android 10 java.lang.SecurityException #606
  • How to change prompt input to upper or lower case in JS? #603
  • Does this repo is maintained? #592
  • Plyer notification not working on android #591
  • Feature Request: Add Intent to Android Gallery(for Pictures) #588
  • plyer.filechooser.save_file doesn't work on macOS X Catalina #578
  • macOS notification NSUserNotificationCenter is deprecated + missing Info.plist #449

Merged pull requests:

  • action-gh-release now uses github.token #724 (misl6)
  • Bump version to 2.1.0 for release #723 (misl6)
  • Bump action-gh-release to a newer version #721 (misl6)
  • Update supported Python versions #720 (misl6)
  • Fixes some E275. + other minor PEP8 fixes #711 (misl6)
  • Document linux support for orientation #709 (rshah713)
  • Document supported platforms for humidity #704 (rshah713)
  • Keyword should only hold name of license #701 (rshah713)
  • Document supported platforms in native filechooser #700 (rshah713)
  • Fix Keystore comment to point at correct class #697 (rshah713)
  • Add missing platform for barometer #695 (rshah713)
  • Add missing platforms in audio #694 (rshah713)
  • Fixes a failing test for notification #692 (misl6)
  • Fixes style check #691 (misl6)
  • Clear documentation for Processors #689 (rshah713)
  • Create clear documentation for Keystore #688 (rshah713)
  • Added tick in ios native file chooser row #685 (Neizvestnyj)
  • :zap: Fix pep8 violations #678 (Zen-CODE)
  • :hammer: Fix pep 8 failure for CICD #677 (Zen-CODE)
  • fix some errors in readme file #676 (AdamMusa)
  • android 11+ compatibility Documents folder #672 (moonpyx)
  • Use sys.getandroidapilevel for more robust Android detection #670 (rdb)
  • More robust way to get application icon on Android for notification #669 (rdb)
  • Added the ability to track the closure of the file manager without selecting content #667 (Neizvestnyj)
  • Fix bug, when user canceled filechooser, on_selection does not dispatched #666 (Neizvestnyj)
  • Bigger buffer, allows large selection #655 (akshayaurora)
  • fix: fix filechooser save dialog for the KDE #652 (psyrykh)
  • Change R$drawable to R$mipmap in notification.py for android platform #648 (masterjoseph914)
  • linux/storagepath: fixup a host of issues #646 (rski)
  • Change PythonActivity java class #642 (Neizvestnyj)
  • Enabled transient notifications on Linux #639 (olumidesan)
  • updated-device-name-implementation-for-backward-compatibility #634 (ljnath)
  • Added contributors in readme.md file #633 (ljnath)
  • Fixed pep8 errors #632 (ljnath)
  • Removed python2.6|7 reference and added reference for python 3.6|7|8 #631 (ljnath)
  • Support to get android device name or hostname for linux and windows #630 (ljnath)
  • #611 add filters for file chooser on android #624 (akshayaurora)
  • docs: fix a few simple typos #623 (akshayaurora)
  • Add check for Trinity Desktop Environment #620 (akshayaurora)
  • FileChooser: MacOS: Use objectAtIndex_ to get multiple items #618 (akshayaurora)
  • add installation section in README.md #563 (tshirtman)

2.0.0 (2020-11-09)

Full Changelog

Closed issues:

  • Macox notification - AttributeError: 'NoneType' object has no attribute 'setDelegate_' #586
  • Can't display notifications with Plyer #582
  • Unable to set app orientation #579
  • Does plyer allow you to open another app? #577
  • Calling notification.notify() raises "No Usable Implementation Found!" Error on Android #575
  • tts is not working #572
  • bluetooth for Android #571
  • raise NotImplementedError() NotImplementedError when I use tts #567
  • Filter variable may be uninitialized in MacOSX filechooser #566
  • Plyer camera cannot save image to the IOS phone #561
  • How to turn on gps ?? #556
  • How to disable mock location (fake gps) in kivy #555
  • Release notes for v 1.4.3? #550
  • battery.status isCharging always shows false in WINDOWS #541
  • Filechooser on mac: using path, crashes python #524
  • Android Filechooser not working #512

Merged pull requests:

1.4.3 (2020-03-27)

Full Changelog

Closed issues:

  • IOS - GPS : 'IosGPS' object has no attribute '_location_manager' #538
  • Android FileChooser crashes when back button pressed #534
  • Notification not working on android #533
  • FileChooser on Android: "on selection" fires multiple times. #530
  • KIVY cannot access the android camera.. #521
  • No notification icons on Linux (Gnome) #514
  • Vibrator is not working on Android #509
  • notification.notify crashes Android Pie devices #504
  • Vibrate revision in api 26 #501

Merged pull requests:

  • Fix linter warnings in examples/gps/main.py #545 (ghost)
  • Switch to GitHub actions #544 (ghost)
  • Fix crash in Android Notification (SDK_INT >= 26) #543 (ghost)
  • Add native iOS FileBrowser #542 (Zen-CODE)
  • Prevent crash when cancelling filechooser #536 (Zen-CODE)
  • Make win filechooser use modern windows browser and fix small issues. #535 (matham)
  • Prevent re-binding of callback on each call #532 (Zen-CODE)
  • Add permission request to plyer GPS example #529 (Zen-CODE)
  • Handle absence of LinuxFileChooser backend #526 (Cheaterman)
  • Fix vibrator, which was not working on Android devices. #523 (ghost)
  • Added logic to support the on_status method of the gps facade for i… #519 (Dirk-Sandberg)
  • Fix default audio file_path assignment error, file_path change for Py3 #518 (Nephyx)
  • Add Windows applications storage path #517 (magnusvmt)
  • fix typo in supported API list #516 (holdbar)
  • fix the issue that tts.speak() crashes on android #511 (Chao-Jen)
  • Addresses plyer issue #240. #502 (Dirk-Sandberg)
  • Update README.md to add opencollective #499 (tito)
  • Bump to 1.4.0 for release #496 (KeyWeeUsr)

1.4.2 (2019-09-05)

Full Changelog

1.4.1 (2019-09-05)

Full Changelog

Closed issues:

  • I'll be Working on Linux audio #497
  • Notification and service #494
  • Windows notification - NotImplementedError: No usable implementation found! #485
  • macOS notification NSUserNotificationCenter is deprecated + missing Info.plist #449

1.4.0 (2018-12-31)

Full Changelog

Implemented enhancements:

  • Windows microphone support #179

Closed issues:

  • jnius.jnius.JavaException: Class not found 'android/content/INTENT' #479
  • macOS storagepath uses non-standard path for get_home_dir() #450
  • Example Applications break down on a real device #338
  • Feature request: Accelerometer on Linux (computers) #9
  • Linux wifi implementation via rockymeza/wifi is broken #487
  • Hardcoded 'wlan0' does not work on all devices #477
  • GNU/Linux wifi disconnect() not working on Ubuntu 15.04+ #452
  • Plyer Email #420
  • notification not working on android #402
  • plyer.accelerometer not working with Kivy Launcher #401
  • New PyPI release after 1.3.0 #400
  • plyer.notify.notification doesn't show ticker in Android #378
  • plyer.uniqueid.id causes crash on Android with sdl2 #245
  • audio: JVM exception occurred: setAudioSource failed. #210
  • Something wrong with encoding in AndroidNotification #175

Merged pull requests:

1.3.2 (2018-11-16)

Full Changelog

Implemented enhancements:

  • [Feature Request] Termux support #360
  • storage path support #152
  • unicode broken in notifications on windows 8. #17
  • Feature Request: Add adjustable tooltip text to Windows notification #14

Closed issues:

  • plyer notifications raising NotImplementedError on android #467
  • TypeError when running examples in Python 3 #392
  • when i use buildozer and python3crystax to build apk it not work ? #380
  • Windows filechooser crash #375
  • Using the camera crashes the app #369
  • after calling an plyer audio function from an accelerometer function, App crashes. #361
  • uniqueid.id fails under android and windows7 32bit python2.7 #277
  • Strange string returned by filechooser on Windows #177
  • Email Support for OSX #32
  • GPS Support for iOS #22
  • Camera Support for iOS #21
  • Example app for Camera facade #16

Merged pull requests:

1.3.1 (2018-10-14)

Full Changelog

Implemented enhancements:

Closed issues:

  • plyer.wifi.is_enabled() always return false running in python3 #436
  • kivy-ios fails to build plyer #417
  • Python 3 TabError #398
  • is there a way of using the front camera instead of back #391
  • storagepath.py _get_application_dir: NotImplementedError #389
  • plyer app crashes on android #387
  • Can't pip install plyer through git #385
  • speech to text #382
  • text2speech doesn't work on platform Linux #372
  • Changing file_path in audio.py example is not working #356
  • How to change file_path of audio in plyer? #355
  • Accelerometer in plyer #354
  • iOS Gyroscope crashes #352
  • Need keystore for storing user credentials #350
  • plyer examples app always crashes in android phones, It says "Unfortunately "Name of app" has stopped working." #349
  • Notification not working on Windows #333
  • Accelerometer not working on linux #327
  • 1.3.0 broke notifications on Windows #318
  • No encoding and °C causes SyntaxError #312
  • GPS double output on output return value #302
  • Cannot import wifi module in windows #272

Merged pull requests:

1.3.0 (2017-03-23)

Full Changelog

Implemented enhancements:

  • Feature Request: Alarms #8

Closed issues:

  • Notification.notify crashes android app #296
  • GPS android crash on launch #288
  • Send SMS feature not working #261
  • gps.configure() results in exception #257
  • v1.2.4 archive not available via github #234
  • SyntaxError in wifi.py for Linux #230
  • New PyPi release please, to fix static jfieldID not valid for class java.lang.Class<org.renpy.android.PythonActivity> #229
  • Drag-and-drop: originate in Kivy, drop in some external app #228
  • GPS Issue after in iOS after last changes in plyer #224
  • battery.status isCharging always shows false #221
  • GPS example only updating location once #217
  • uniqueid.id raises exception on Windows #212
  • Redundant libs folder #209
  • accelerometer on Android with Kivy Launcher 1.9.0 not working #206
  • Camera on android doesn't return to app #200
  • android compass suggestion #195
  • more example code to the docs #166
  • Mail API on linux raises error NameError: name 'Email' is not defined #131
  • native gui widgets #124
  • android: using gps app cannot resume from pause #112
  • Please upgrade pypi ! #94
  • UniqueID using OpenID #83
  • Display the notification in the right places #78
  • Python3 All The Plyer! #12

Merged pull requests:

v1.2.4 (2015-06-01)

Full Changelog

Implemented enhancements:

  • Update platform check code #109

Closed issues:

  • webhook test #142
  • Sync style check updates from the Kivy repo #141
  • GPS on android doesn't work (a strange error) #136
  • Create toast notification facade for Android and iOS #126
  • uniqueid.id empty on linux. #114
  • Gyroscope Support for iOS #111
  • AndroidUniqueID doesn't use Android ID #107
  • OverflowError: Python int too large to convert to C long [android lollipop] #103
  • Feature request: ability to open browser to a particular page #98
  • AndroidGPS list GPS Provider but use hardcoded "gps" #54
  • Email Support for Android < 4.0 #42

Merged pull requests:

1.2.3 (2015-01-27)

Full Changelog

1.2.2 (2015-01-27)

Full Changelog

Closed issues:

  • NotImplementedError: No usable implementation found! whith usable implementations on the system. #108
  • Gyro example #101
  • Notification is not working in android #93
  • plyer.notification.notfy() raises NotImplementedError under Python 3.3 in Linux but not Python 2.7 #58

Merged pull requests:

  • Linux platform check made compatible with python 3.3+ (Fixes #58) #102 (helenst)

1.2.1 (2014-08-19)

Full Changelog

Implemented enhancements:

  • Feature Request: codec-independent sound player #2

Closed issues:

  • Battery status connected is actually isCharging #84
  • Email Support for Windows #36
  • Accelerometer Support for OSX #29
  • Email Support for Linux #28
  • Email Support for iOS #25
  • TextToSpeech Support for iOS #24

Merged pull requests:

1.2.0 (2014-06-24)

Implemented enhancements:

  • Feature Request: Add adjustable timeout option to Windows notification #13
  • Changes notify to use ctypes instead of win32gui so we could use unicode. #18 (matham)
  • User-specified icon support for Windows notifications #11 (brousch)
  • Added Vibrator facade and android implementation #6 (inclement)

Closed issues:

  • GPS example crashes #40
  • TextToSpeech Example App #20
  • Accelerometer Example App #19

Merged pull requests:

* This Change Log was automatically generated by github_changelog_generator

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plyer-2.1.0.tar.gz (121.4 kB view hashes)

Uploaded source

Built Distribution

plyer-2.1.0-py2.py3-none-any.whl (142.3 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page