I found that if I want to use the searchable options using the search key I have to create a content provider. Content provider is used to share data across applications.
But I do not want to allow access to my content provider (as well as my data) except/outside my own application. I want to use it only for search suggestion. Because my app data is kind of restricted.
Is there any way to implement local search without content provider? OR is is possible to apply restriction so that except my own app no other app can use my content provider?
Thanks.
Is there any way to implement local search without content provider?
Don't integrate with the search framework. There is nothing stopping you from having your own separate search mechanism within your app (e.g., an activity that is opened from a Search menu item).
OR is is possible to apply restriction so that except my own app no other app can use my
content provider?
Your app isn't the one using the content provider -- the operating system is the one using the content provider. That's why trying to apply this sort of security is tricky. C2DM uses some related techniques, and it is possible that the core Android team will apply the same techniques to the search integration in the future, but I wouldn't hold my breath.
In the interim, either sanitize your search suggestions such that they are safe for publishing through a regular content provider, or implement your own search activity.
Related
We have a requirement to share some very simple data between Android apps, the data will basically just be a string but we want to ensure it's only shared between apps signed by us. The sharing of the data also needs to be programmatic i.e. without user interaction to initiate the sharing.
The issue we have with many of the data sharing methods we've found is that they imply the data is owned by one particular app which then makes it available to other apps. The data we need to share could be generated by any app so it doesn't have a natural owner.
Our ideal solution would be something similar to the Keychain on iOS where any app can write the data and any app can easily check if the data has already been written.
We have seen some solutions that involve setting a shared User ID for the apps but this appears to be deprecated in Android and also one of our apps is already in the store so the ID cannot now be changed.
Is anyone aware of any possible solutions on Android for this usecase?
It seems when you download a new Google Suite app for iOS - whether GMail, Inbox, Calendar or whatever - they offer you to log in with your account and already present to you the account you have logged in elsewhere.
The question is both for iOS and for Android.
I know that apps can use Safari or the new Safari WebView (Chrome Tabs in Android) and a permanent cookie to share data between apps. It's a bit clunky, and can be broken by the user deleting cookies. But other than that, it works.
Google seems to be using something else. AdvertisingID? How exactly do they achieve this feat of sharing data on both operating systems?
AppGroup allows data sharing between two different apps or even app and widgets by creating one common shared path (like document directory). Data saved over there can be accessed by any app which is associated with that particular AppGroup. It is an offline data sharing between apps.
Communicating and persisting data between apps with App Groups
On Android:
They probably use Content Providers. As described in this link,
A content provider manages access to a central repository of data. A
provider is part of an Android application, which often provides its
own UI for working with the data. However, content providers are
primarily intended to be used by other applications, which access the
provider using a provider client object. Together, providers and
provider clients offer a consistent, standard interface to data that
also handles inter-process communication and secure data access.
A content provider coordinates access to the data storage layer in your application for a number of different APIs and components, these include:
Sharing access to your application data with other applications;
Sending data to a widget;
Returning custom search suggestions for your application through the
search framework;
Synchronizing application data with your server;
Loading data in your UI.
TL;DR In short, Content Provider is a layer that allows you to share your database with other apps/widgets. So Google Probably has a Content Provider in every app which shares the accounts that have been used on this app.
On iOS:
Now I'm just an Android Developer, but after a quick Google Search, I found this post which talks about UIPasteBoard:
Use the UIPasteboard class to let a user to share data from one place
to another within your app, and from your app to other apps. For
sharing data with any other app, use the systemwide general
pasteboard; for sharing data with another app from your team—that has
the same team ID as the app to share from—use named pasteboards.
I can't assure you that this is exactly the way Google does it. But If I were to implement such thing across my apps, I would use this.
Everyone knows that Facebook reads user's SMS-content on Android. Me tasked to create fake Content Provider and redirect Facebook to read fake SMS database.
I'm trying to create my own content provider to replace default Telephony on Android, which will handle Facebook's requests separately.
So, there are two questions:
1) Where can i find complete project of TelephonyProvider? Decompilation of TelephonyProvider.apk has no good results.
2) How can i handle requests of specific app separately in content provider?
Me tasked to create fake Content Provider and redirect Facebook to read fake SMS database.
Fortunately, this is not possible, for blindingly obvious privacy and security reasons, unless you control the device firmware.
I'm trying to create my own content provider to replace default Telephony on Android
Fortunately, this too is not possible, for blindingly obvious privacy and security reasons, unless you control the device firmware.
Where can i find complete project of TelephonyProvider?
http://source.android.com.
How can i handle requests of specific app separately in content provider?
You can see if Binder.getCallingUid() returns something that identifies the app that invoked the ContentProvider -- I do not know if that works or not.
I'm working on two applications that will share the same data. The obvious solution is to use a content provider. What I'm not clear on is the deployment.
My initial thoughts are that the content provider will be developed as a library and included in each of the apps. I know there are problems with this;
The content provider would be deployed twice and have the same authority. In know the authority could be changed but then you effectively have two content providers.
Sqlite uses the context to determine where the data is stored. So in which app is the data stored? If I delete the app the data will go with it. I imagined it would have some central store but this doesn't appear to be the case.
Over time the content provider may be updated. We could end up with a situation with an updated app using the older content provider.
An alternative to that is to deploy the content provider in one of the apps or in its own app but that then causes a dependency. The apps would have to have the content provider app installed. Not a great user experience.
What is the best strategy for this? Content providers seems to be the right way forward but leaves me with a lot of questions.
What is the equivalent of Android's content provider in iOS?
Summary:
A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object. Together, providers and provider clients offer a consistent, standard interface to data that also handles inter-process communication and secure data access.
Docs:
http://developer.android.com/guide/topics/providers/content-providers.html
If I'm understanding that link correctly, there is no equivalent.
On iOS, apps can't share resources between each other in that way. For security reasons, each app has it's own data and is sandboxed from being able to access the data within another app.
The only ways you could share data between apps is to have some network sync process between your apps, or possibly use UIPasteBoard but that's cumbersome. You can also pass very limited data via the app URL scheme.
There's a way to share content between apps via keychain if one wanted to in iOS. I think this is the closest I can think of that is equivalent to the content provider in Android.
Good reference here: http://shaune.com.au/ios-keychain-sharing-data-between-apps/
In iOS we can share data between apps having same group id.
[iOS App Group] allows you to share data between between different processes from the same development team
[iOS App Extension] allows you to share common functional