开发者

APK that needs another apk to function

I am implementing a kind of location provider that I would like to distribute as an apk. If someone implements an application that uses the classes of my apk it is necessary that my apk is installed on the device first. My "location provider" offers an API that can be used by other programmers (it has no U开发者_如何学GoI).

I wonder if it is even possible to do something like this. Normally I would use a jar but it is easier to distribute as a apk.

Is it possible to include an apk in for example Eclipse so that other programmers can use my API for their applications? I tried it but did not get it to work but I am also not an expert in Eclipse.

Hope someone has done something like that already and can give me a hint.

Thanks, Benjamin


Is it possible to include an apk in for example Eclipse so that other programmers can use my API for their applications?

No. Use a JAR or an Android library project.


Generally, the best way to do this is with content providers.

So basically, you would set up a URI, something like content://com.yoursite/locations, and your app would return a list of locations, or whatever it promised to return.

One example on how to do this would be the Notepad Code that comes with the SDK.


You can import ANYTHING into eclipse, but that doesn't mean it's going to have classes available to you.

If you're trying to call someone else's application, and you have an intent you can target (like if you wanted to scan a barcode using the ZXing app), you can call that intent, and if it fails, redirect the user to the market to download it (then next time you call it, it'll succeed).

If you're trying to wrap someone else's apk, that's not possible.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜