My app not launching in split screen - why? - android

I can manually open my two apps in Split screen view, using the Recent apps button.
I believe I have added the "split screen support" in my apps, as per How to enable split screen in my Android app?
My targetSdkVersion is 29 and I have set resizeableActivity="true" in tag
Now I want to have one launcher to open both apps. I am using this open source app SplitScreenLauncher to launch my app. Following are the observations:
When I launch my two apps, using SplitScreenLauncher, it attempts to open them in split screen but then it immediately closes the 2nd app (I tried swapping the apps). It shows no error/message.
I try YouTube and Instagram. It clearly says "Your app doesn't support split screen" for Instagram.
I tried YouTube and Google Maps, it works.
When I use YouTube as first and MyApp as second app in SplitScreenLauncher, then it works. And if I use MyApp as first and YouTube as second app, then it doesn't work (acts like step 1). This is true for both of my apps, I tried one by one.
I have tried some tweaking in the code of this open source app, I don't understand why it doesn't work for my app.
In my app, I have removed any orientation restrictions in all activities, so it is auto rotate able.
What could be the issue?

I found the problem. It was in my Apps, both apps unfortunately. After Splash screen, I was doing startActivity() after finish(). finish() was closing all activities before i could start new, so split screen was going away. Now I finish() after startActivity(), and it works.

Try adding this line in your activitiies in manifest file
android:resizeableActivity="true"

Related

Instant app won't start directly, shows a screen first

I have successfully published a (very simple) Instant App linked to my personal website.
When I click on my website's link, I was expecting the app to start directly, but instead, I first see a screen with 2 buttons: "Open app" and "Open in browser":
Why?
Other instant apps that I tried do not show this screen and open the app directly (the desired behavior).
We call this screen the "speed bump". It's a security feature. You're right in noticing that it doesn't always trigger. But there's nothing you, as a developer, can do to control whether it shows. The intention is for it to be a black box from your perspective.
This is designed in my opinion to happen at least once to give the user an opportunity to decide what to use: either browser or the instant apps feature.

Is it possible to open an app in a small window WITHIN my own app?

Currently I am trying to build my school project in Android and I am afraid I have chosen a really difficult project to complete. I would ask if it is possible to open a 3rd party application in a small window within my application. When I try to start a 3rd party application via a button click, the application starts and I cannot go back to my application any more. I want to start another application IN my application, take a screenshot of it, and close this small window. I would kindly ask you to help me in this subject. Thank you very much in advance.
I would ask if it is possible to open a 3rd party application in a small window within my application
No, sorry.
I want to start another application IN my application, take a screenshot of it, and close this small window
You can start an activity via startActivity(). With user permission, you can take a screenshot of whatever is on the screen, by means of the media projection APIs. You cannot:
embed the UI of the other activity in yours
open the other activity in a "small window" (though the user could, using split-screen capabilities in Android 7.0+)
At the end of the day, I decided to use multiwindow. Adding the line below into my code, I made it to run in a small window. Then I was able to start the other activity in the big window.

opening another Android app in a 'new window' from Air

This is a little involved, so bear with me.
I've got two Android apps - one built in Adobe Air (the 'launcher') and one downloaded from the google play store (the 'target.') At a certain point I want the 'launcher' to open the 'target' and switch to it. Currently I'm doing this via the 'intent' protocol, like so:
navigateToURL(new URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=com.magix.camera_mx/com.magix.android.cameramx.main.MainMenu;end'));
... and it works, but when the 'target' (CameraMX in this example) opens, it uses the same 'window' as the 'launcher' app. Here's two screenshots, before and after opening the 'target:'
That's inconvenient, but I could put up with it if it was consistent. However, when I try the exact same process, only launching an arbitrary other app like Kingsoft Office:
navigateToURL(new URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component=cn.wps.moffice_eng/cn.wps.moffice.documentmanager.PreStartActivity;end'));
The 'target' and 'launcher' exist as nice separate windows.
Why is that? What dictates whether an app comes up as a separate window, or reuses the current one? I've tried it with a handful - notably SoulCraft and Starchart launch in a new windows, but mostly the others all reuse the current window.
Is that something I have control over from within my air app? What's going on here?
What you're calling a "window" is referred to in Android as a "task". You should be able to force the target application to open in a new task by setting appropriate flags, namely FLAG_ACTIVITY_NEW_TASK (note the launchFlags=0x10000000):
intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=<your-package-name>/.<your-activity-name>;end
The difference between your two scenarios (scenario 1 remains in a single task, scenario 2 starts a new task) is due to each "target" app's intent-filter manifest definition.
If you do not require a result from the Intent you can add flags (http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK) like below:
navigateToURL(new URLRequest('intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=com.magix.camera_mx/com.magix.android.cameramx.main.MainMenu;end'));

Transparent activity that really clear other Activities

I have a small android machine that has android and other native process at same time.
Because the graphic of native is below, android app should be transparent.
I read many sources, made transparent activity and it works.
But it is special app for my machine, thus it should act like Launcher.
The thing is... if I back to my app after launch another app, the screen still shows another app's image.
Ex: My app(Home) - Other non-transparent app - (back/home) - My app shows previous other app's image, because my app is transparent.
So I want to make my app to clear all screens and be transparent to show native's graphic. I don't mean finish others. I want to clear or turn off visibility of other apps only.
FYI, I can't wrap the native to android app with JNI. The native process is old and big legacy. :(
Thanks in advance.
Have a look at FLAG_SHOW_WALLPAPER. Setting that to your activity will make it seem like all other apps were closed/hidden:
http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_SHOW_WALLPAPER

Android - creating custom launcher

I am intending to develop custom Launcher for Android phone. I have searched web, but I haven't found any valuable information regarding creating "launcher" project. What does an android app needs for being at the top of the GUI (aka launcher)?
I saw this thread a while ago, before creating my own launcher. Here are some crucial things I learned:
Declaring your app to be a launcher
David already mentioned the piece of code that determines your app as a launcher:
<category android:name="android.intent.category.HOME" />
Add this as an intent-filter to the activity your launcher will use for the home screen (in AndroidManifest.xml).
Launcher Issues
As a launcher will run all the time, you need to understand the activity livecycle to prevent issues (like this one).
If you want users (and yourself) to be able to constantly user the app (that's what you usually do with launchers), make sure it never crashes. In the case of a crash users will be taken back to the devices default launcher or other installed ones.
In short: Launchers are expected to be reliable.
Common launcher functions (users usually expect those)
1) A list of apps / appdrawer
From which all apps can be launched or modified. You can use packageManager to list the apps.
As generating such a list may take a while, I suggest you to do it asynchronously and save the list somewhere to speed everything up (which also is expected from launchers ^^)
2) Some settings to change the launcher
I had some users stuck in my launcher before implementing those ^^
You can open the devices launcher settings like this (in Kotlin):
// working in APIs newer than Lollipop
val callHomeSettingIntent = Intent(Settings.ACTION_HOME_SETTINGS)
startActivity(callHomeSettingIntent)
Bonus) An in-app tutorial
This may be useful if you have some features in your app that are not trivial, ways of launching apps that users don't know from other apps.
It also gets you way less messages from users asking how to interact with your software.
Resources:
The GitHub of the minimal launcher I created may be helpful: finnmglas/Launcher
Well, firstly you need to listen to the android.intent.category.HOME intent. Here are some links with full source code which you can have a look at:
Old launcher source code
New launcher source code
Or take a look at launcher plus.

Categories

Resources