开发者

Sharing elements between Android apps, a question of best practices

Here's a quote from Android's Dev Guide:

A central feature of Android is that one application can make use of elements of other applications (provided those applications permit it). For example, if your application needs to display a scrolling list of images and another application has developed a suitable scroller and made it available to others, you can call upon that scroller to do the work, rather than develop your own.

Isn't it开发者_JAVA百科 a bad practice to make an app dependent on other apps?


It depends on the use case. The best example for this is the barcode scanner app. Many apps are depending on this app to be installed to work properly, this makes your app a little bit unflexible and you have to guide the user through installing another app if the scanner is not available but you don't need to do all the work of scanning the code yourself.

You could also integrate the library of the scanner in your app. But that means you will need to republish your app every time the scanner library changes and they have frequent changes to adjust the lib to all different phone capabilities like auto focus, flash etc.

You have to cautious if you depend on other apps. Have a clear strategy what to do if the app you depend on is not available and a good example on how to guide the user through the installation process of the other app. Only use apps that have a good reputation and are unlikely to have an api change without announcing it properly and also monitor the changes in the app you depend on.

If you are cautious enough and integrate the other app in a good way you can benefit a lot from the intent system that is used inside of android. Some examples I love about it is:

  • Integration with a twitter client (the user don't need to give twitter credentials to every app)
  • Integration with maps (full benefit of the mighty maps app not only a mapview inside the app)
  • The mentioned barcode scanner
  • Sending emails to the email app of the users choice
  • ...

If your app won't run without other apps you may run into serious troubles marketing your app. But with the use of Intents you get many small nice features without much work to extend your app.


Definetly it is.

This feature as I know was intented to be able to write plugins to existing apps. In this case as you develop plugins the user needs to have the core app to use it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜