I want to start an app that is shown inside my app. At the moment I just start another app over mine with
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage(app.getAppID());
startActivity(LaunchIntent);
That works good, but I'd like to let the user know, my app is still in the background. With a colored frame for instance. I thought of loading the new app inside a fragment like with iframes in HTML but could not find a way.
Any help is appreciated.
This is not possible on Android, sorry.
Each app runs in its own process, and there is no way to run one inside another like an iframe.
I think you are confusing applications with activities.
You can run a shared activity in your application but not the entire application. So this would greatly depend on what you are trying to do.
Related
I have an app that works best if the main activity is always the same activity instance, otherwise, it would be very confusing to users. When I first coded this app years ago, the solution I found was to use:
android:launchMode="singleTask"
android:taskAffinity="somestring"
And this works well for the most part, but when some apps share stuff with my app, it is like my app becomes part of their app and now it is like I have two separate instances of my app. If I go to the task switcher and select their app, it will actually go to my app. This works fine with most apps that can share stuff with my app, only some will cause this issue.
How can I get around that issue?
Edit: As it was pointed out, it is not two separate instances but my users think it is, and it is annoying them a lot.
Edit: The issue appears to be when the sharing app uses startActivityForResult instead of startActivity.
What I need to know is, Is it even Possible to view an app within another
app?
I have tried to find out how but I found much topics speaking about launching apps from another only
For example: To have an application that views the file manager, specific music player and google chrome and be able to switch between them with something like tabs?
You will have to do an IPC for what you like to acheive. have a look at this link. Though am not sure if you can run it the way you want.
http://developer.android.com/guide/components/aidl.html
I'm trying to build an application that would run at the same time as another one, on top of it (hiding only partially the original app), that would display useful information for the user of the main app.
But it seems that 2 activities cannot run at the same time, overlap, etc...
For argument sake, lets say the app would be displaying date & time in a corner of the screen, while playing a specific game.
Anyone got any doc or sample code on how to achieve such a result ?
I'm also interested in how to know which app is currently running in order to decide in my app-on-top to be visible or invisible.
Any help appreciated :)
Thx
Looks like you are in need of Fragments: Fragments
The Android system is designed to be user friendly, and two activities at same time is not, so only one activity is on foreground at once. if you need the other to be running in background make it a Service, if you want to show some data and get back first one use a Dialog, finally if you want both you can either put them in one activity or use Fragments as #Tooroop suggsets.
Its propably too late ... but for others with the same problem:
check out how-to-draw-on-top-of-other-applications
and maybe also this if your app need to be on top on fullscreen apps
Alright so I have an app that I would like to have utilize other apps. For example I have an app that does quite a number of things except for a directory look up since there is already an app that does that for my school. I know I can launch the application with intents, but that also brings them away from the navigation menu for my application. Is there anyway that I could run an app inside a view layout. I am not hopeful for this but I figured I would chance asking it anyway.
This is technically possible by using widgets. You can implement an AppWidgetHost, and other applications can create App Widgets to use inside your own app. This is how the launcher screen in Android works.
This, of course, will only work if other applications in question implement widgets. So, the general answer to your question would be no, it is not possible to host arbitrary applications or Views/Activities from other applications inside your own.
This not the Android design philosophy. You should send an Intent to the directory app, which I hope is designed to look up a result and then return it to you. The mechanism is startActivityForResult() in your app, and setResult() in the directory app.
Actually, I found lots of answers for my questions but this time I am totally stuck.
My question is very easy. I am building a radio streaming application for .pls streams and when the user press the home button, I want my application to continue working. I think lots of you know ebuddy and Skype or the basic media players. They are putting themselves to notification bar and you can easily reach them from this place. I tried to create a notification for my app, but when I click the icon on the notification bar, I can't reach my app. It directly opens a new version of my app and I can't control the streaming, the initial working app is no longer existing.
You may want to read the descriptions for LaunchMode: http://developer.android.com/guide/topics/manifest/activity-element.html#lmode
You want to launch your Activity as singleInstance
Edit: maybe singleTask would be better.
This is the workflow you want to achieve:
All background work has to be done by a service. Implementing one is quite simple, almost as creating an activity.
There are many examples on how to do it:
http://developer.android.com/reference/android/app/Service.html
http://marakana.com/forums/android/examples/60.html
http://code.google.com/p/openmobster/wiki/AndroidService
You need the actual music playing part - or the part that should continue running in the background - to be a service, and the gui to be an activity. The notification you made should bring your activity gui to the front with a flag_activity_reorder_to_front.