2

Before i ask my question i will first explain some background information.

Our company is developing an app for iOS and Android. Our customers can decide to use our app (branded) or integrate our functionality into their app. As our app has some complex algorithms and communication protocols on-board. For this reason we want to provide a kind of SDK for our costumers who wants to integrate instead of using our app.

As we use BLE, NFC and GPS, we decided to make our own apps native. The issue is that many of our customers already have an app which will be a hybrid app in the most cases. So "just" making an SDK for all platforms is almost impossible, not only to build but even more to maintain.

Another important thing to keep in mind is that we want avoid that our customers need to understand our complete communication process, even stronger we won't give our algorithms or communication protocols to others because this is what makes our app/product unique at this moment.

So now the concrete question. Is it possible to provide our functionality as a kind of API so other apps can use the functionality of our app like a kind of API? This means that our app needs to be installed also on the end users smartphone but they don't need to use it individually. The idea is that the app of our customer communicates with our app like an API, our app does the communication with our hardware and gives back the result to the app of our customer. Note that user of the app should not see our app in foreground. (I have the idea from some games who requires "Play Games")

I know there is a way to exchange data between apps (Inter-App Communication) but can this also be used like kind of API?

DJ-Glock
  • 1,277
  • 2
  • 12
  • 39
CodeNinja
  • 836
  • 1
  • 15
  • 38
  • Do you mean like a Content Provider https://developer.android.com/guide/topics/providers/content-provider-basics.html – Kuffs Oct 25 '17 at 07:35
  • If i understand well, this is for exchanging data between apps. This is just a part of solution we need. We are looking for a way that other apps can use a complete function of our app (if possible). E.g. they call a methodOne(params) function of our app so our app does the "complex things". After the method is executed our app should give a response to the app of our customer if the method is executed successful. This avoids that our customer needs to understand our technology/method and we do not need to provide SDK's/code for all mobile platforms. Thanks anyway. – CodeNinja Oct 25 '17 at 08:10
  • So you are telling that if other apps need a service say, advertise a data using BLE they want to install your app and use your functionality? – noobEinstien Oct 25 '17 at 08:27
  • you must look into react native its a semihybrid platform which allows you to integrate the modules created in node.js in your native app. so make your library which will perform the whole thing which you want to obfuscate and the use that modules in both you ios and android apps, after that you must provide the way off communication with your app to others, like in case of android a content provider or a binder of sticky service – Adeel Turk Oct 25 '17 at 08:37

2 Answers2

1

Obviously this answer relates to Android only. (You may want to ask a separate question for IOS)

At its most basic, a Content Provider is used to exchange data. However, nothing prevents code being run in the provider host to extract that data.

For example, You can host a Content Provider in your app which when called with specific parameters, performs a number of your complex functions and returns a simple table of data (MatrixCursor) or even just a simple True/False response within that cursor.

You could further simplify the usage of this by creating an Android Library that your customers could import into their own project to make it more friendly and API like by adding methods and functions to the library that then delegated their calls to the Content Provider or even to a Broadcast receiver in your main app which could then respond with its own broadcast.

You could even make use of invisible Activities. i.e Call an activity in your app that has no UI.

Even more preferable would be to create your callable code as a self contained library that your customers could use which would negate the need to talk to separate apps completely.

Kuffs
  • 35,581
  • 10
  • 79
  • 92
0

In my understanding, you need other apps to invoke a particular functionality, say call a web API or open an activity and write something or open a popup dialog and do something.

In android: Yeh, it is possible by BroadcastReciever. you only have to listen to the particular action and perform the functionality.

So the task is, you only have to supply the action.

noobEinstien
  • 3,147
  • 4
  • 24
  • 42
  • Yes, i need to invoke a partikular function of our app from an other app like an web API. In the most optimal situation, the end user doesn't see that our app is used. Thanks for you're answer, i will check the BroadcastReceiver. – CodeNinja Oct 25 '17 at 08:25
  • @RoDo If you want to share some data use `ContentProvider` ,If you want to do some process the only way is `BroadcastReciever`. If you want more info feel free to ask I will edit my answer – noobEinstien Oct 25 '17 at 08:30