forked from inway/flutter_ringtone_player
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Running service in foreground to play alarm sounds
- Loading branch information
Showing
12 changed files
with
180 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ android { | |
} | ||
|
||
dependencies { | ||
api 'androidx.core:core:1.2.0' | ||
api 'androidx.annotation:annotation:1.1.0' | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
android/src/main/java/io/inway/ringtone/player/AlarmNotificationMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.inway.ringtone.player; | ||
|
||
import java.io.Serializable; | ||
import java.util.Map; | ||
|
||
public class AlarmNotificationMeta implements Serializable { | ||
private final Map<String, Object> notificationMetaValues; | ||
|
||
public AlarmNotificationMeta(Map<String, Object> notificationMetaValues) { | ||
this.notificationMetaValues = notificationMetaValues; | ||
} | ||
|
||
public CharSequence getContentTitle() { | ||
return (CharSequence) notificationMetaValues.get("contentTitle"); | ||
} | ||
|
||
public CharSequence getContentText() { | ||
return (CharSequence) notificationMetaValues.get("contentText"); | ||
} | ||
|
||
public CharSequence getSubText() { | ||
return (CharSequence) notificationMetaValues.get("subText"); | ||
} | ||
|
||
public String getIconDrawableResourceName() { | ||
return (String) notificationMetaValues.get("iconDrawableResourceName"); | ||
} | ||
|
||
public String getActivityClassLaunchedByIntent() { | ||
return (String) notificationMetaValues.get("activityClassLaunchedByIntent"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
example/android/app/src/main/res/drawable/ic_alarm_notification.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#0085F4" | ||
android:viewportHeight="24.0" android:viewportWidth="24.0" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="#FF000000" android:pathData="M22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM7.88,3.39L6.6,1.86 2,5.71l1.29,1.53 4.59,-3.85zM12.5,8L11,8v6l4.75,2.85 0.75,-1.23 -4,-2.37L12.5,8zM12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx1536M | ||
android.useAndroidX=true | ||
android.enableJetifier=true | ||
android.enableR8=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class AlarmNotificationMeta { | ||
final String activityClassLaunchedByIntent; | ||
final String iconDrawableResourceName; | ||
final String contentTitle; | ||
final String contentText; | ||
final String subText; | ||
|
||
AlarmNotificationMeta(this.activityClassLaunchedByIntent, this.iconDrawableResourceName, | ||
{this.contentTitle, this.contentText, this.subText}); | ||
|
||
Map<String, dynamic> toMap() => { | ||
'activityClassLaunchedByIntent': activityClassLaunchedByIntent, | ||
'iconDrawableResourceName': iconDrawableResourceName, | ||
'contentTitle': contentTitle, | ||
'contentText': contentText, | ||
'subText': subText, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters