[Android] Use target API 23
This commit is contained in:
parent
96bfcafc97
commit
e54744e5ef
|
@ -106,7 +106,7 @@ gradle.projectsEvaluated {
|
||||||
'--reset-cache')
|
'--reset-cache')
|
||||||
|
|
||||||
// Disable bundling on dev builds
|
// Disable bundling on dev builds
|
||||||
//enabled !devEnabled
|
enabled !devEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
|
// Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
|
||||||
|
|
|
@ -39,11 +39,11 @@ import java.net.URL;
|
||||||
*/
|
*/
|
||||||
public class JitsiMeetActivity extends AppCompatActivity {
|
public class JitsiMeetActivity extends AppCompatActivity {
|
||||||
/**
|
/**
|
||||||
* Code for identifying the permission to draw on top of other apps. The
|
* The request code identifying requests for the permission to draw on top
|
||||||
* number is chosen arbitrarily and used to correlate the intent with its
|
* of other apps. The value must be 16-bit and is arbitrarily chosen here.
|
||||||
* result.
|
|
||||||
*/
|
*/
|
||||||
public static final int OVERLAY_PERMISSION_REQ_CODE = 4242;
|
private static final int OVERLAY_PERMISSION_REQUEST_CODE
|
||||||
|
= (int) (Math.random() * Short.MAX_VALUE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of the {@link JitsiMeetView} which this activity will display.
|
* Instance of the {@link JitsiMeetView} which this activity will display.
|
||||||
|
@ -56,6 +56,14 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
||||||
*/
|
*/
|
||||||
private boolean welcomePageEnabled;
|
private boolean welcomePageEnabled;
|
||||||
|
|
||||||
|
private boolean canRequestOverlayPermission() {
|
||||||
|
return
|
||||||
|
BuildConfig.DEBUG
|
||||||
|
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||||
|
&& getApplicationInfo().targetSdkVersion
|
||||||
|
>= Build.VERSION_CODES.M;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see JitsiMeetView#getWelcomePageEnabled
|
* @see JitsiMeetView#getWelcomePageEnabled
|
||||||
|
@ -64,6 +72,22 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
||||||
return view == null ? welcomePageEnabled : view.getWelcomePageEnabled();
|
return view == null ? welcomePageEnabled : view.getWelcomePageEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the {@link #view} of this {@code JitsiMeetActivity} with a
|
||||||
|
* new {@link JitsiMeetView} instance.
|
||||||
|
*/
|
||||||
|
private void initializeView() {
|
||||||
|
view = new JitsiMeetView(this);
|
||||||
|
|
||||||
|
// In order to have the desired effect
|
||||||
|
// JitsiMeetView#setWelcomePageEnabled(boolean) must be invoked before
|
||||||
|
// JitsiMeetView#loadURL(URL).
|
||||||
|
view.setWelcomePageEnabled(welcomePageEnabled);
|
||||||
|
view.loadURL(null);
|
||||||
|
|
||||||
|
setContentView(view);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the given URL and displays the conference. If the specified URL is
|
* Loads the given URL and displays the conference. If the specified URL is
|
||||||
* null, the welcome page is displayed instead.
|
* null, the welcome page is displayed instead.
|
||||||
|
@ -82,15 +106,11 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
||||||
int requestCode,
|
int requestCode,
|
||||||
int resultCode,
|
int resultCode,
|
||||||
Intent data) {
|
Intent data) {
|
||||||
if (requestCode == OVERLAY_PERMISSION_REQ_CODE) {
|
if (requestCode == OVERLAY_PERMISSION_REQUEST_CODE
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
&& canRequestOverlayPermission()) {
|
||||||
if (!Settings.canDrawOverlays(this)) {
|
if (Settings.canDrawOverlays(this)) {
|
||||||
// Permission not granted.
|
initializeView();
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setupView();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,21 +132,19 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// In debug mode React needs permission to write over other apps in
|
// In Debug builds React needs permission to write over other apps in
|
||||||
// order to display the warning and error overlays.
|
// order to display the warning and error overlays.
|
||||||
if (BuildConfig.DEBUG
|
if (canRequestOverlayPermission() && !Settings.canDrawOverlays(this)) {
|
||||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
|
||||||
&& !Settings.canDrawOverlays(this)) {
|
|
||||||
Intent intent
|
Intent intent
|
||||||
= new Intent(
|
= new Intent(
|
||||||
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
|
||||||
Uri.parse("package:" + getPackageName()));
|
Uri.parse("package:" + getPackageName()));
|
||||||
|
|
||||||
startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
|
startActivityForResult(intent, OVERLAY_PERMISSION_REQUEST_CODE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setupView();
|
initializeView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,18 +185,6 @@ public class JitsiMeetActivity extends AppCompatActivity {
|
||||||
JitsiMeetView.onHostResume(this);
|
JitsiMeetView.onHostResume(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupView() {
|
|
||||||
view = new JitsiMeetView(this);
|
|
||||||
|
|
||||||
// In order to have the desired effect
|
|
||||||
// JitsiMeetView#setWelcomePageEnabled(boolean) must be invoked before
|
|
||||||
// JitsiMeetView#loadURL(URL).
|
|
||||||
view.setWelcomePageEnabled(welcomePageEnabled);
|
|
||||||
view.loadURL(null);
|
|
||||||
|
|
||||||
setContentView(view);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @see JitsiMeetView#setWelcomePageEnabled
|
* @see JitsiMeetView#setWelcomePageEnabled
|
||||||
|
|
|
@ -63,9 +63,9 @@ function _audio(state = AUDIO_INITIAL_MEDIA_STATE, action) {
|
||||||
* @type {VideoMediaState}
|
* @type {VideoMediaState}
|
||||||
*/
|
*/
|
||||||
const VIDEO_INITIAL_MEDIA_STATE = {
|
const VIDEO_INITIAL_MEDIA_STATE = {
|
||||||
|
available: true,
|
||||||
facingMode: CAMERA_FACING_MODE.USER,
|
facingMode: CAMERA_FACING_MODE.USER,
|
||||||
muted: true,
|
muted: false
|
||||||
available: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue