I've created an app that has been in the android marketplace for a few months now. I'm trying to create a complimentary app that will be used inside the first app. I need the second app to be optional, and not necessary for the first app to work properly. I'm hoping to call the main activity from the second app within a Tab Host tab on the first app.
My questions are: how do I run an activity from a secondary app with a different package? Is it possible to have the activity be in a tab host?
I'd be happy to post code, but my code seems to be nowhere close to what I'm trying to get. I don't think I can adjust the build path of the primary app, because the secondary app can't be required. Also, Since the app has been in the marketplace for a while, I can't use SharedUserIds.
Thanks for all help.
TJ
It is not possible to do it to run any arbitrary activity in your app.
I have done this before, with activity group, which has been already deprecated. And there are also limitations to use this approach:
Your app has the same UID with the target package.
Your app has system UID
If you met either condition list above, you can start the child activity and get its window root view, and add into your layout.
Related
I am working on app locker to show lock on selected apps by getting top applications's package name. For this purpose I'm calling the method in my service every 1 second to check which application is on top. I have implemented the answers given in these links https://stackoverflow.com/a/28066580/13005440 , https://stackoverflow.com/a/38829083/13005440. Its not working properly in my pixel 2 (Android 10) device. The above methods return correct package name for some apps like youtube when it opens first time / after minimize but not for other apps like messages, playstore etc. I want to implement my app lock on app minimize.
Note: When applications (messages, playstore etc) open 1st time it returns correct package name, but when that application goes to background by minimize then re-open app the method will not return its package name.
I have searched a lot but didn't find any way that will work on android 10 properly
As someone pointed out in the thread you got your solution from, are you giving the right permissions?
You need this one:
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"/>
I will prevent some application to be deleted from the phone.
Now, I can get current top activity name using ActityManager and check if it is com.android.packageinstaller.UninstallerActivity, than do additional logic for checking which package will be deleted. but I can't get UninstallerActivity object, and more - I can't get Intent passed to com.android.packageinstaller.UninstallerActivity (which will provide package name for me).
Seems like this isn't possible with standart Android API way. maybe it's possible using hidden API and reflection.
Any ideas?
Edit: I'm writing Launcher application, which will be distributed manually in hotels. I will have functionality which prevents from deleting my Launcher application from the phone, because mobile phones will be given in rent, and Launcher replacement isn't possible.
Note: The phone will be rooted!
Just starting with android.
I try to create project that will send notification ( some bit for example ) to my FTP server every 3 hours.
I don't know how to create this project because each time i create new android project i must have only project with activity - and i don't need any activity - just need a service that will run when i install it on the device.
each time i create new android project i must have only project with activity
If you are using Eclipse, uncheck the "Create activity" checkbox that tells the new project wizard to create an activity.
If you are using android create project, yes, it will create an activity for you. You can delete the Java class and the manifest <activity> entry if you want.
In reality, you will wind up leaving all of it alone.
just need a service that will run when i install it on the device.
First, a service does not run just because you install it on the device. It only runs if you write code to cause it to run.
Second, while you might think "well, I will just get control at boot time and start the service then", that is possible, but it will not work on Android 3.1+ devices unless the user has run an activity first. This is to prevent "drive-by" malware.
So, I suggest that you leave the activity in there, if you want your app to work.
Moreover, unless this app is only for yourself, your users need the activity, to:
Control the behavior of the service, such as changing the "every 3 hours" setting to something they prefer
Read your license agreement
Read your documentation, including how to get support
Etc.
I have been trying to figure this out on the web with no information whatsoever as to what this actually does. The Google Manifest information says:
Allows an application to set the maximum number of (not needed) application processes that can be running.
I am thinking this is not a third party app permission but I need to be sure, its for our embedded device.
My guess is that this limits the number of processes that one application can have open when calling android:process=".RemoteActivity" in the manifest.
Anyone? Thank you.
It's a development/debug intended permisson. And just do what it says. Remember that when you run an app, android creates a process for all it's activities. This is, if you start opening the different activities of your application, you use the same process. However, Android let's you choose if an activity uses the main process or another new one. That's why this permission exists.
Sources:
http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html
http://developer.android.com/reference/android/Manifest.permission.html#SET_PROCESS_LIMIT
I was studying some sample examples for Android and one of them got me really curious:
the NoteList (or Notepad) example application - here
My question is: Is there any way to make a NoteList shortcut, that always starts the application with its 'Editor' activity, for example. [of course if the creator of that 'third-party' application intended to make it possible by describing the entry points of its application in a proper way in the manifest file. I do not intent to create malware.]
in other words:
Can a third-party application (like the one I wish to make :) ) to get to internal application intents {i.e. action, activity, data} or this is handled by Android and no one else?
What gave the idea that this is possible was the following case:
I opened NoteList, created a few note, and when I was editing the title of one of the notes - I pressed HOME, when I clicked on the icon of NoteList I got the exact same state of the application - editing the title of the note.
thanks!
One has nothing to do with the other. That means that reopen an activity which was paused or killed with a data restoring logic just restores the last state. This is what happened in your example.
Now what you mean I guess is if there is a way to tell Android that you application can do a certain thing thus it should be shown as an option in the action chooser. Yes that is possible through intent filters.
The Intent reference page might also be very informative for you.