add support for installing .apk/.apk.1
This commit is contained in:
parent
8e6dbf961e
commit
46b49d9d31
|
@ -112,6 +112,20 @@
|
|||
android:name="com.tungsten.fcllibrary.crash.CrashReportActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|keyboard|navigation"
|
||||
android:screenOrientation="sensorLandscape"/>
|
||||
<activity
|
||||
android:name=".activity.InstallActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask">
|
||||
<intent-filter
|
||||
android:label="@string/install_apk"
|
||||
tools:ignore="AppLinkUrlError">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:scheme="content" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<service
|
||||
android:name="com.tungsten.fclcore.download.ProcessService"
|
||||
android:process=":processService"
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.tungsten.fcl.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class InstallActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Uri uri = getIntent().getData();
|
||||
String path = uri != null ? uri.getEncodedPath() : null;
|
||||
if (path != null) {
|
||||
path = path.toLowerCase();
|
||||
if (path.endsWith(".apk") || path.endsWith(".apk.1")) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
intent.setDataAndType(uri, "application/vnd.android.package-archive");
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
|
@ -905,4 +905,5 @@
|
|||
<string name="world_time">yyyy 年 MM 月 dd 日 HH:mm:ss</string>
|
||||
<string name="menu_settings_gamepad_aimzone">辅助瞄准区</string>
|
||||
<string name="account_failed_expired">凭据已过期,请删除账户重新登录。</string>
|
||||
<string name="install_apk">安装apk文件</string>
|
||||
</resources>
|
|
@ -948,4 +948,7 @@
|
|||
<string name="world_reveal">Reveal in Explorer</string>
|
||||
<string name="world_show_all">Show All</string>
|
||||
<string name="world_time">EEE, MMM d, yyyy HH:mm:ss</string>
|
||||
|
||||
<string name="install_apk">Install .apk</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue