• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About applications that have more than one apk...

 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently read that an android application can have more than one apk(called shared apks- perhaps this was outdated).
Are there any special considerations to make in such cases?
Can we have BarcodeScanner.apk as one of our shared apk(this sounds dumb but I am not sure if BarcodeScanner is open for use like that)?
Can we load classes of other apks at run time?




Thanks.
 
Devender Thareja
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Monu,

My understanding is that only one apk per application can be deployed. But the I understand apk as soemthing like zip file, so it might be possible to package the apk within apk. ??
I believe you can not share an apk with other developers but probably you can for your own applications provided you use same encryption key for deployment.

However, it is possible for applications to communicate between themselves using ContentProviders, Activities and IntentFilters. You should design your apps such that the library is required by only one app and others apps communicate with that app using recommended mechanisms.

Hope it helps.
 
Michael Rivera
Ranch Hand
Posts: 131
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe your thinking about content provider?
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies Devender and Michael..

I am aware of content providers, intent etc. Just wanted to check on teh possibility of a shared apk.

Thanks again.
 
Monu Tripathi
Rancher
Posts: 1369
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Perhaps this is not a good example...]
I had a REST web service client written in J2SE using classes in Apache's HttpClient and dom4j. I was able to add the entire project(classes,jars etc.) as is and could run them on android(I got a lot of warning messages in the console though).

You should be able to add third party jars and use them in your project but with a caveat that these jars are "heavy" for mobile devices.

[Reason why I said this is not a good example is: Android comes with those classes(HttpClient & XML parsers) already built-in. So, I should have been using those instead.]
 
Devender Thareja
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Monu,

Yes you can add the jar to any deployment.
I thought the question you are trying to explore is that if it is possible deploy a jar in one app and use it another without deploying it again. That I believe is not possible.

 
Michael Rivera
Ranch Hand
Posts: 131
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think so!
 
Mark L. Murphy
Author
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recently read that an android application can have more than one apk(called shared apks- perhaps this was outdated).


A better way of looking at this is saying that two independent APKs can more closely cooperate.

If the two APKs are configured to run under the same user ID (via the manifest) and if they are signed with the same certificate (the default case for debug apps), then those two APKs can access each other's files, including databases, directly via explicit file paths (/data/data/your.package.here/files).

This simplifies integration somewhat, as you do not need to mess with remote services or content providers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic