Commit 1c7336c3 by 霍志良

feat:

parent 54289d1a
...@@ -37,7 +37,7 @@ android { ...@@ -37,7 +37,7 @@ android {
multiDexEnabled true multiDexEnabled true
ndk { ndk {
abiFilters "armeabi-v7a" // 指定要ndk需要兼容的架构(这样其他依赖包里mips,x86,armeabi,arm-v8之类的so会被过滤掉) abiFilters "arm64-v8a" // 指定要ndk需要兼容的架构(这样其他依赖包里mips,x86,armeabi,arm-v8之类的so会被过滤掉)
} }
} }
......
...@@ -78,7 +78,12 @@ class DemoAppLifecycles : IAppLifecycles { ...@@ -78,7 +78,12 @@ class DemoAppLifecycles : IAppLifecycles {
// flutterEngine.getLocalizationChannel().channel.setMethodCallHandler(plugin); // flutterEngine.getLocalizationChannel().channel.setMethodCallHandler(plugin);
val intent = Intent(application, PlayService::class.java) val intent = Intent(application, PlayService::class.java)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
application.startForegroundService(intent)
}else{
application.startService(intent) application.startService(intent)
}
// application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle()); // application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
Stetho.initializeWithDefaults(application) Stetho.initializeWithDefaults(application)
......
...@@ -40,7 +40,7 @@ ext { ...@@ -40,7 +40,7 @@ ext {
"ydl-media" : "0.0.21.10", "ydl-media" : "0.0.21.10",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.41", "m-audioim" : "0.0.49.29.41",
"ydl-flutter-base": "0.0.14.29", "ydl-flutter-base": "0.0.14.31",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
...@@ -122,7 +122,7 @@ ext { ...@@ -122,7 +122,7 @@ ext {
"ydl-media" : "0.0.21.10", "ydl-media" : "0.0.21.10",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.41", "m-audioim" : "0.0.49.29.41",
"ydl-flutter-base": "0.0.14.29", "ydl-flutter-base": "0.0.14.31",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
...@@ -271,7 +271,7 @@ ext { ...@@ -271,7 +271,7 @@ ext {
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块 //flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块 "ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.33@aar", //flutter aar "ydl-flutter" : "com.ydl:ydl-flutter:0.0.37@aar", //flutter aar
// "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar // "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号 //基础组件 <<--- 先发这个,发完改这里的版本号
......
...@@ -38,7 +38,7 @@ android { ...@@ -38,7 +38,7 @@ android {
flavorDimensions "versionCode"//Flavor 维度信息 flavorDimensions "versionCode"//Flavor 维度信息
ndk { ndk {
abiFilters "armeabi-v7a" abiFilters "arm64-v8a"
} }
} }
......
...@@ -52,7 +52,7 @@ abstract class BaseFlutterActivity : FlutterActivity() { ...@@ -52,7 +52,7 @@ abstract class BaseFlutterActivity : FlutterActivity() {
public override fun onCreate( savedInstanceState: Bundle?) { public override fun onCreate( savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this) // GeneratedPluginRegistrant.registerWith(this)
/** /**
* 获取统一路由传递过来的参数并初始化交互通道 * 获取统一路由传递过来的参数并初始化交互通道
......
...@@ -97,7 +97,7 @@ public final class Flutter { ...@@ -97,7 +97,7 @@ public final class Flutter {
arguments.bundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext()); arguments.bundlePath = FlutterMain.findAppBundlePath(activity.getApplicationContext());
arguments.entrypoint = "main"; arguments.entrypoint = "main";
flutterView.runFromBundle(arguments); flutterView.runFromBundle(arguments);
GeneratedPluginRegistrant.registerWith(flutterView.getPluginRegistry()); // GeneratedPluginRegistrant.registerWith(flutterView.getPluginRegistry());
} }
@OnLifecycleEvent(Lifecycle.Event.ON_START) @OnLifecycleEvent(Lifecycle.Event.ON_START)
......
package com.ydl.media.audio package com.ydl.media.audio
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.Service import android.app.Service
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Binder import android.os.Binder
import android.os.Build
import android.os.IBinder import android.os.IBinder
import android.util.Log import android.util.Log
import androidx.core.app.NotificationCompat
import com.ydl.media.audio.constants.Extras import com.ydl.media.audio.constants.Extras
import com.ydl.media.audio.manager.MediaSessionManager import com.ydl.media.audio.manager.MediaSessionManager
import com.ydl.media.audio.manager.NotifyManager import com.ydl.media.audio.manager.NotifyManager
...@@ -23,6 +27,15 @@ class PlayService : Service() { ...@@ -23,6 +27,15 @@ class PlayService : Service() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.O){
var nm = getSystemService(NOTIFICATION_SERVICE) as NotificationManager;
//数字是随便写的“40”,
nm.createNotificationChannel( NotificationChannel("40", "App Service", NotificationManager.IMPORTANCE_DEFAULT));
var builder = new NotificationCompat.Builder(this, "40");
//其中的2,是也随便写的,正式项目也是随便写
startForeground(2 ,builder.build());
}
Log.i(TAG, "onCreate: " + javaClass.simpleName) Log.i(TAG, "onCreate: " + javaClass.simpleName)
AudioPlayer.get().init(this) AudioPlayer.get().init(this)
MediaSessionManager.get().init(this) MediaSessionManager.get().init(this)
......
...@@ -23,7 +23,7 @@ android { ...@@ -23,7 +23,7 @@ android {
flavorDimensions "versionCode" flavorDimensions "versionCode"
ndk { ndk {
abiFilters "armeabi-v7a" abiFilters "arm64-v8a"
} }
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
} }
......
...@@ -26,7 +26,7 @@ android { ...@@ -26,7 +26,7 @@ android {
} }
ndk { ndk {
abiFilters "armeabi" abiFilters "arm64-v8a"
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment