Giter Club home page Giter Club logo

ringtone_set_mul's Introduction

ringtone_set_mul

Flutter package for easily setting device's default ringtone, notification sound and alarm.

Important

Works only on Android

original rep:

GitHub - rtacr/ringtone_set: Flutter package for setting the default ringtone or notification sound

Getting Started

Add these lines to AndroidManifest.xml.

<manifest>
...
    <uses-permission android:name="android.permission.WRITE_SETTINGS"
        tools:ignore="ProtectedPermissions" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
...
</manifest>

Set from assets

Put your sounds into <yourapp>/assets/ add them to your pubspec.yaml

flutter:
  assets:
    - assets/music.mp3
dependencies:
  ringtone_set_mul: ^0.0.1

Import the package

import 'package:ringtone_set_mul/ringtone_set_mul.dart';

Call the function

RingtoneSet.setRingtone("assets/music.mp3");

or

RingtoneSet.setNotification("assets/music.mp3");

or

RingtoneSet.setAlarm("assets/music.mp3");

Set from Network

You can also set ringtone from network URL:

RingtoneSet.setRingtoneFromNetwork("https://example.com/music.mp3");

or

RingtoneSet.setNotificationFromNetwork("https://example.com/music.mp3");

or

RingtoneSet.setAlarmFromNetwork("https://example.com/music.mp3");

Set from File

Finally, you can set ringtone from a File object as well:

final File ringtoneFile = File("music.mp3");

RingtoneSet.setRingtoneFromFile(ringtoneFile);

RingtoneSet.setNotificationFromFile(ringtoneFile);

RingtoneSet.setAlarmFromFile(ringtoneFile);

ringtone_set_mul's People

Contributors

jun19 avatar

Watchers

 avatar

ringtone_set_mul's Issues

Hint that compileSdkVersion needs higher

I reported an error when using the sample code。
The following example:
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to /Users/xx/Downloads/ringtone_set_mul-main/example/android/app/build.gradle:
android {
compileSdkVersion 33
...
}

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.