Associating 2 Apps together - android

I have a project “Abc12” which contains App “TypeYourName”.
Also I have another project “Xyz12” which contains a Service like “MySoftKeyboard”, which is NOT a library type project.
I’d like to associate project “Xyz12” to project “Abc12”, so when user downloads App “TypeYourName”, App “MySoftKeyboard” is also downloaded with it.
Any idea how can be done, if possible ?

I don't think you can do this as separate .apk files. (At least I'm pretty sure you can't do this either in the Android Market or the Amazon Appstore. I also don't know how you could side-load two apk files from the same link.) Create a single project that has your app and also has the service.
It might make sense to put all the code for the service into a library project. Then you could have the service available as a stand-alone project and also bundled with other applications.

You can't. The best you can do is within Abc12, query the package manager for Xyz12, and if it is not present, prompt the user to download it. Make Xyz12 a service or define the proper intent so that ABC12 can access it.

Related

How to create a system app for custom ROM

We have a custom ROM for a device we are making and what I want to do is make our own custom Settings app to replace the settings app that comes already built in android.
I cant really find any documentation on how to even create a system app. It does not appear you can create it in Android Studio, I tried looking on the AOSP site and didnt find anything there related to creating system apps. The few things I did find were on here where you would put android:sharedUserId="android.uid.system" in your manifest and then has to be signed with the same key as the ROM but after that I cant find anything.
The settings app I want to create would need access to the framework.jar to be able to use the hidden framework API's.
Does anyone have any information or know where I can find this information on how to go about actually creating a system app?
You may want to research how to make a Device Tree Overlay (dto). Basically it is your code, reformatting the base code, into what you want. https://source.android.com/devices/architecture/dto?hl=en
Since you said you use Gradle, you should put first build you apk and put them in you vender folder, and next important thing is to create a mk/bp file to tell the Android build system how to deal with this pre-built apk.
P.S. If you system app highly depends on Android hidden api, make sure you have the right version of framework.jar in you Android Studio project, or, as what I alway did, create apps directly in AOSP, in this case, you can just check the code structure of the original Settings app in AOSP
this tutorial may help you.

android app adding content during runtime

Hello I am trying to build an app which will hold "other app's"
For example MY app will hold different apps of different ClIENTS.
Now i want to make it so that 1 client has the option to only download his part, BUT he still has to use MY main app. (in other words i don't want to reference to another APK, cause then he can start his app without using mine(i think))
And the download option should be at runtime, cause else he has to download everything in one go.
I have thought about using jar files as library files, but what i found so far is that you have to add them in Eclipse (else they are not found)
I also thought about building the app with the jar files in it, and then leave them out when i compile the app. Then my client can download those files afterwards. But i am guessing that will cause reference errors?
So the questions are;
Is it possible?
How to go about?
The main idea is that i don't want to make one HUGE app where as my client will only use his part of it.
Thanks in advance
It can be achieved in android, and some big platform apps could let the 3rd party developers to develop plugins for them. The main idea is try to create your own DexClassLoader to replace the default one, the custom DexClassLoader could load classes from apkfile.
Try to look through this article for details.
Same with this question.
It seems this is a difficult topic. I can only give you some point.
Since you don't want to make a huge app, then you have to build CLIENTs as separate APKs. But if you don't define CLIENT's activity as MAIN and DEFAULT in manifest, after install CLIENT app, user could not find CLIENT app from system menu (launcher). You can define a private intent name for CLIENT app's activity, this way, only your main app could start CLIENT app's activity.

how to install two instances by one apk?

I developed an app for android, but I need to install two instances of it, one for my daily use, another for debug/development, I don't have too many phones for debug, just have one phone, and don't want to debug on emulator, because it's too slow compare to real phone.
Or is there any thing we can change on APK file, then we can install it as another app, e.g. change it's package name ?
Currently, I changed the package name in code then make them to two apps, which can be installed on the same phone, but this way is not convenient. seek for simple way.
Update: is there any tool to modify package name in androidmanifest.xml directly after packaged(apk file)? then we just need unzip the apk, modify the androidmanifest.xml, zip the apk again.
You've answered the question yourself. You have to change the package name in the manifest, otherwise Android will override the old app (or can't install it, if the certificate differs).
Try changing the the name of the app in strings.xml from resource folder #string/app_name to have multiple instances of the same app. And package name must be changed so that the existing app is not overridden.
You can copy your project and change the package name in the copy.
You can use the same SVN path to apply the changes on the two projects.
Or you could automate the different builds using an ANT build.xml file with parameters. There are several examples on how to do this for Android in Google.
ref: One android application, one startup view, two icons
I would make the original app a library project and create a new project which uses the library project.
Advantage:
you can have both running as your new project should have a different package name
easily identification by overriding the app name in your new project (just add "beta" to it)
both versions can be installed on one device/emulator parallel
pretty good setup if you try to verify the update process of your app
no confusion with a version control system - renaming packages results in awful non-real changes on your development branches
Disadvantage:
you need to "uncheck" the library setting before you can release the original project
you might need to change some stuff in both manifest files which will increase the maintainability in a small manner
If you really need a market version of your app on your device, this method is the easiest one as a package rename will very probably result in worse maintainability.
edit:
You can mark a project as a library project in project preferences -> Android. After that you can link add that library project to another normal android project at the same spot, just click on the add button.

Check from which market(Amazon or Samsung or Google) is an app installed?

check whether the Amazon or the samsung market or the google play that installed android app in device.
Say if i have app named ABC installed in my android phone. In my application i list down all the apps installed in my phone and need to list the market from where they where downloaded.
How can this be done?
Quoting an answer from Detect if app was downloaded from Android Market
Starting with API 5, you can use
PackageManager.getInstallerPackageName(String). From the
documentation:
Retrieve the package name of the application that installed a package.
This identifies which market the package came from.
To get the package of the Android Market, this post may help.
I guess with the appropriate devices, you could build an app to output the package names of each market you want to recognise.
One option is to package them individually. If at some point you decide to use any marketplace specific features, such as licensing or in-app payments, you'll need to do that anyway.
A manageable way of doing so is a library project containing almost everything and a number of mini-projects that rerference it and contain only the specifics.
The drawback: multiple projects instead of one. The benefits: manageability, maintainability.
Edit: if you still prefer using the certificates for that, this example can help: thomascannon.net/misc/android_apk_certificate/ .
Please post the solution you eventually come up with.
I did it this way(a single src and res folder for all projects, different LauncherActivities for each market):
Copy your res and src folder somewhere like /sharedsources/
Make a three new projects for Google/Amazon/Samsung.
Delete the res and src folder from each project
In each project link to /sharedsources/res and .../src
Now make a three new activities:
e.g. GoogleLicensing,AmazonLicensing,SamsungLicensing
Google Project Manifest: set GoogleLicensing as Launcher Activity
Samsung Project Manifest: set SamsungLicensing as Launcher Activity
Amazon Project Manifest: set AmazonLicensing as Launcher Activity
Google Project: remove SamsungLicensing and AmazonLicensing activities from build(dont delete)
Samsung Project: remove GoogleLicensing and AmazonLicensing activities from build(dont delete)
Amazon Project: remove SamsungLicensing and GoogleLicensing activities from build(dont delete)
Done.
Export each Project.
Keep in mind that you have three AndroidManifests now, which need to be edited accordingly.
Also keep in mind that you should only have one project open at a time.
There is no reason for opening more than one anyway, since they share the same source...
Actually i did this to be able to swap between Linux and Windows (my sharedsources folder is on a shared hdd) only for 1 project, but it worked out very well for the different markets aswell.

Replace a system application with your own modified application on android

I downloaded the source code of OI Notepad and did some modifications to it. And then made an .apk file out of it. But when I try to install the .apk it shows
This is a system application.
Do you still want to replace it?
When i say yes it moves forward but does not install it..
I have this post My application tries replace another my application and the answer given there the package name of both the apps cannot be same.
But is there any way in which I can manage to install modified OI Notepad without any hassles of replacing the older one. It happens in Emulator..
Thanks
If you are using eclipse you can right click the package tree and use the refactor option to quickly change the package. This, in most cases, correctly updates the Application Manifest for you. This 'should' resolve the error you are having keeping in mind that you will now have two versions of the application so it may be in your best interest to change the application name of your custom version so you can easily distinguish between the two.

Categories

Resources