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
Related
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 recently have gotten very interested in android development. I have this application that needs to be able to store user accounts onto a database. How do I go about making this database network accessible, so users of my application can access their account? I've been looking into this and I think that content providers are one method of solving this problem. However, I don't know anything about content providers so some clarification would be great. Anyways here are my questions straightforward:
How do I go about making a database network accessible so users of my android application can access their account?
What is a content provider and are they free?
Thanks for your time and I appreciate the help.
Good questions, but too broad and open-ended. Also, I find it hard to understand
You have an application that needs to be able to store user accounts onto a database. Where will the database be, on the web or on the device? Do you want to be able to access a web database from the device? Do you intend to store the user accounts on the device?
If you have a web-based database, you have to provide a web server to get data from the database and offer it to your Android app. There are many ways to do this.
A content provider is one of the four main building blocks of an Android app (the others being activity, service, and broadcast receiver). Content providers provide a standard interface between local data and other components, including components in other apps. A content provider can handle files, databases, and even internal data structures you build within the provider, but most content providers encapsulate an SQLite database.
In regard to transferring data between a server and the device, content providers often represent the location of the local data. Content providers don't automatically transfer data, but in conjunction with other parts of Android a content provider simplifies the process of detecting when data has changed.
To transfer data between the device and a server, you'll need to set up your server to provide database data using HTTP, learn how to connect to the HTTP server interface from Android, send requests (I suggest the REST protocol) to access the server, send REST requests to transfer data, and then store the data on the device, probably by using a content provider.
You may also need to learn how to work with user accounts in Android, using the android.accounts.Account class.
Most of these topics are described in detail at the website developer.android.com, which is Google's official Android SDK documentation.
How can i access a database which is in a different application. I want to access the data and use it for an other application how am i suppose to do it. I dont even have a clue how to access data from a different application please help.
Read this article:
"Application modularity – The Android system allows applications that are signed by the same certificate to run in the same process, if the applications so requests, so that the system treats them as a single application. In this way you can deploy your application in modules, and users can update each of the modules independently if needed."
"Code/data sharing through permissions – The Android system provides signature-based permissions enforcement, so that an application can expose functionality to another application that is signed with a specified certificate. By signing multiple applications with the same certificate and using signature-based permissions checks, your applications can share code and data in a secure manner. "
please use content provider for accomplishing the same
Do you know about content provider?, you can implement the above functionality by using this.
For example, Calendar, Contacts are doing the same.
Check:
Creating a Content Provider
Android SQLite Database and ContentProvider - Tutorial
in Android diff app can share the data with help of content provider
below will help you
http://about-android.blogspot.in/2010/04/content-provider-example-1.html
Stay smiling
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.