How to add shortcut on home screen when app gets install - java

I know it's not the best practice, but it is a requested feature (e.g. for business apps). When the App gets installed, I need to automatically place it on the home screen. I saw a lot of code on the internet, but all of the code only works on button click when the app starts. But I need to place a shortcut on the homescreen immediately after the app is installed and before the app starts. Is there a way I can achieve this?
PS: To make the question more clear: The app will be distributed without Google Play Store, so that's not an option.
Thanks for your help!
Best regards,
Robin

You can't run any code in your application before the user starts your application for first time during to restrictions since Android 3.1. Check this for more information

That's an optional feature of the Market app, not of the apps themselves. When designing an application , it does not receive a broadcast about itself being installed.
the first time the app launched can create it.
You can achieve that by creating a method in your main activity and call this method from oncreate and create a boolean variable andsave it in shared preferences

Related

It's possible to uninstall another apps from my android application?

I want to ask about native app development. My client asking me for making application where the app can easily remove another app on the device (I mean Uninstall another app programmatically) with a spesific shortcut (for example maybe by shake device etc). It's possible to make this app on newest android OS?
if possible, can you give me a reference? or example code to remove another app? thank you!

Android. make a system app that run another app

im making a app that observes for some apps that are runing or not and execute it if dont
i dont know how to oberserve other apps processes and how to start another app that wasnt maked by me.
all that i got for now is run it as system service.
another possibility is create a self app that restart it own when it crashes or be closed.
there is any way to do it ?
My cell is not rooted
For your question, you can learn the application sandbox.
https://source.android.com/security/app-sandbox
When the developer makes an application, they can define their intent filter and tt is some way to let another application invoke it.
You can uncompress .apk from another application and find out the file AndroidManifest.xml. And then you can try it.
But you can just control the part of door they open to you.

Is it possible to know the app which is opened currently?

I am a beginner in android development. I want to know that is it possible to know the app which is opened currently. I came to know that finding the apps which are running currently through Activity Manager (getRunningTasks()) is now removed from the Android studio. So I want to know is there any other way to know? I just want to know the app which is opened and running currently on the mobile but not the apps running in the background Could somebody please help me in this case?
You can use AccessibilityService to get event notification. But AccessibilityService are specifically for accessibility uses. If you use the service for other purposes, then the application will more likely to be downed/removed for PlayStore due to policies. Another viable option is UsageStatsManager, but with some limitations.
UsageStatsManager is not push event based system. You have to poll in few mills(depends upon the use-case)
Usage Access Permission grant/deny is not straight forward. You have to start Setting Activity with Settings#ACTION_USAGE_ACCESS_SETTINGS action and have to rely on the users understanding of how to grant permission(Since permission list may contain other applications).

Launch my application when a user opens a certain application - Android

Is there a way to open my application when a user opens a certain application?
For instance, I want to launch my application's floating button as soon as the user opens Instagram. Or even better is they open the "story" camera?
This is different from inexplicit intent, since, I don't have a way of interacting with Instagram, but is it still possible?
Do I need to check with the system to see which application are currently open or is there another way of doing this?
As NomadMaker says, in general this is difficult to do because it would be a security issue. In fact, an issue like this was published as the Strandhogg vulnerability. That said, some apps (like LastPass) use/abuse the AccessibilityService API to get this information. This would be an OK way to do this if you're making an app for yourself, but is discouraged if you plan to distribute the app.

How to start an Android application inside my application? (example provided)

I found some launchers that are able to run installed apps inside their own activity. ( https://play.google.com/store/apps/details?id=com.lwi.android.flapps )
This launcher adds their own functions like maximize, minimize etc. I guess they are creating widgets (because they need drawing over apps permission) and running inside them. But how :)
Can you show me how I can run another android application inside my own activity, widget etc. like this app did ?
Best,
Kerg
I think the following documentation should help you out with learning how to get your app to interact with other apps: https://developer.android.com/training/basics/intents
Especially interesting to you would be the section on sending the user to another app: https://developer.android.com/training/basics/intents/sending

Categories

Resources