xixunplayer
This commit is contained in:
parent
45c88743d6
commit
c5e8aa2b22
|
@ -1,10 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
xmlns:tools="http://schemas.android.com/tools" >
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
|
||||
<uses-permission
|
||||
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
|
@ -16,27 +18,40 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.XixunPlayer">
|
||||
android:theme="@style/Theme.XixunPlayer" >
|
||||
<service
|
||||
android:name=".RestartService"
|
||||
android:exported="false" >
|
||||
<intent-filter>
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name">
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<service android:name=".Server"
|
||||
android:exported="true">
|
||||
|
||||
<service
|
||||
android:name=".Server"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="com.xixun.action.PlayerInfo"/>
|
||||
<action android:name="com.xixun.action.PlayerInfo" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
<receiver android:name="com.xixun.xixunplayer.BootCompletedReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="999">
|
||||
|
||||
<receiver
|
||||
android:name=".BootCompletedReceiver"
|
||||
android:exported="true" >
|
||||
<intent-filter android:priority="999" >
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
|
@ -8,6 +8,7 @@ public class BootCompletedReceiver extends BroadcastReceiver {
|
|||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
System.out.println("BootCompletedReceiver onReceive ---- "+intent.getAction());
|
||||
if(MainActivity.ins!=null) return;
|
||||
intent = new Intent(context, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
|
|
|
@ -59,6 +59,8 @@ public class MainActivity extends ComponentActivity implements Choreographer.Fra
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
startService(new Intent(this, RestartService.class));
|
||||
|
||||
System.out.println("---- MainActivity onCreate ---- UI Thread: "+Thread.currentThread().getId());
|
||||
ins = this;
|
||||
if(ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) init();
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.xixun.xixunplayer;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
public class RestartService extends Service {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
System.out.println("---- RestartService onCreate");
|
||||
if(MainActivity.ins!=null) return;
|
||||
var intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
throw new UnsupportedOperationException("Not yet implemented");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user