Understanding provider attribute "android:multiprocess" in Android Manifest - android

In creating a mobile application for Android, I am dealing with a SQLite database which requires a ContentProvider. The ContentProvider is used for adding, update, reading, or deleting data from the database.
I read http://developer.android.com/guide/topics/manifest/provider-element.html but I did not find any further information what it means, especially for working with databases.
I have seen some manifests that define the following provider:
<provider
android:name="main.ContentProvider"
android:authorities="main.ContentProvider"
android:multiprocess="true">
</provider>
What does it mean to have multiprocess set to true? Does that mean many database queries will be handled simultaneously? And if I set it to false, what happens then?
Thx.

An Android framework engineer said "Don't use this attribute"
https://groups.google.com/forum/#!topic/android-developers/u9UMJtALSXw
Don't use this, it is some old cruft from pre-1.0 design that doesn't
work and should be ignored these days. Just pretend like the
attribute doesn't exist. :}
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email
to android-d...#googlegroups.com To unsubscribe from this group, send
email to android-developers+unsubscribe#googlegroups.com For more
options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-- Dianne Hackborn Android framework engineer hac...#android.com

Don't use android:multiprocess="true".
Not only does it passively not help you, but it even actively causes other problems. For example, if you have android:multiprocess="true" then android:process=":something" doesn't start in a new process.

Related

MatchType in Android Firebase Dynamic Link SDK

I'm implementing a Firebase dynamic link mechanism in Android. We wanted to use Android SDK but to match users only when there is a one-to-one identification between users who clicks the link and user, which opened the app.
In iOS there is MatchType.Unique that serves this purpose:
The match between the Dynamic Link and this device is exact, hence you may reveal personal information related to the Dynamic Link.
https://firebase.google.com/docs/reference/swift/firebasedynamiclinks/api/reference/Enums/DLMatchType#unique
Unfortunately, I can't find anything close in Android SDK.
I will appreciate any help here to find how to distinguish deep links of the unique match type in Android
Thanks
It seems from this part of documentation that the matchType parameter exists only in Swift.
Personally, what I did is creating an array saved in the SharedPreferences, of all the DynamicLink already handled. Then, I just need to check for all the DynamicLinks entering if they are part of this array, and ignoring them in such a case.
Seems that even after an hour, the last DynamicLink handled still remains kind of "active".

Android: Adding SyncAdapters to existing Account

I want to split up functionality from a bigger SyncAdapter to the corresponding Apps. Therefore i now have a single App which contains the Authenticator and a SyncAdapter which syncs core data.
The plan is now, that other Apps also contain SyncAdapters which sync the app-specific data.
Reading https://www.captechconsulting.com/blogs/android-single-account-multiple-application-prescription i tried to add a second adapter like suggested but i'm having the issue that it doesn't show up in the Account's SyncAdapter list.
UPDATE: just figured out that i used the same contentAuthority in the two SyncAdapter declarations (as i only have a single contentProvider) and of course same account-type which leads to a identical declaration and this could be the problem that my second syncadapter just overrides my first one.
still investigating this theory
as already mentioned in the update - the cause was the identical declaration.
you have to use a different contentAuthority (ContentProvider) for each SyncAdapter to get this working!

How to best add a comment/rating system to an android app

I already published an android app where you can see a list of specific objects and detailed informations about them. The list changes every day but some of the objects can appear again.
The application is communicating with a PHP server over HTTP and periodically pulls the list of objects.
I now plan to extend the app to make it possible to rate the objects and add a comment similar to how it is done in the android market. I'd like to avoid forcing the user to sign up for an account for being able to comment.
I see two problems:
The comment-system could be abused by spammers
A comment could be added from another system
So my questions are:
How to protect the system from spam?
How to authenticate the application with the server?
How do I limit the number of comments to one per user and object?
What about the androids device id? Is it unique enough to use it as identifier for the user?
Which other problems do you see?
2020 Commenting/Rating/Reviews Options
Since Socialize is out, here are a few options you can explore:
Build your own comment/rating implementation. Personally I love reddit and how it handles nested comments and ratings. Here's a library I found that implements it beautifully. Please note you'll need to tie this with a cloud-database. This is based on groupie. Article & implementation. Many ways to do this - https://stackoverflow.com/a/59472206/668240
Disqus - SDK's coming soon to iOS and Android.
BazaarVoice - commercial
Social Networks SDKs like Facebook, Twitter, etc. Personally I dislike this as we'll need to authenticate users with respective networks to use the APIs. It's like we are shipping off users of our apps to social networks. If you don't have a problem with that - then it might be for you
Legacy Option in 2014:
You can try out Socialize SDK which is open-source and a really good SDK for the rating and commenting you are looking for. It already has a well-functioning Commenting system built-in along with a 'like/love' facility and sharing to FB and Twitter. Each 'entity' (object in your case) can have metadata associated with it. So all you have to do is construct/use a rating widget, then send that rating with the entity attached to your object. To display your rating/comment is as simple as retrieving them from Socialize.
Each object (element from your app) should be associated with an entity which has a unique key in the form of a URL - sort of like a primary key to recognize your items. This entity can have meta-data - any data that you can insert on behalf of your object. Once you do that, you can retrieve that metadata any time you want.
I've been using Socialize for around a year now. They've matured over this period and are always aspiring to be the best at what they do.
Look at the Socialize Bar at the bottom. Its can be customized to your needs.
What's more - Socialize is free.
As for your questions:
There is comment moderation built into the Socialize Web Component
where you can filter out anything you feel is out of place.
Socialize allows you to authenticate through Facebook and Twitter.
Limiting to one comment per user can be achieved by using their User
and Comments API.
Socialize has both Anonymous authentication as well as Social A/c
authentication. I believe you can remove anonymous auth. So that
ensure that every user is authenticated before rating/commenting.
For authentication, you could use OpenID like StackOverflow does or Facebook authentication. Once you have them authentication, it shoud be easy to limit the number of comments to one per user per object. As far as spam, you could follow StackOverflow's model and allow users to vote comments up or down or flag as spam. Perhaps users with comments that have been voted up would have more power and be able to flag comments as spam.
You'll need some sort of rate limiting. I've used this one in this example before.
So you need a table with the user's ID and how many api calls they have left, and then when their last api call was. Then use the algorithm to update the values in the table every time a method is called.
Read through this, I think it should be possible to create an UUID for every case:
http://android-developers.blogspot.de/2011/03/identifying-app-installations.html
And then keep a hidden api key which is hard coded, or at least get's everytime calculated the same or in enigma style influenced by the time it is used. But you will be never be sure, that it won't be find out by crackers/hackers and maybe abused, you will always have this Problem.
Authenticate with the UUID of the user + api-key.

Android sync without content provider

I use a service to check for stuff on the server, and wanted to transition that to use the standard android sync capability. However, the config file confuses me.
android:contentAuthority
android:accountType
android:supportsUploading
I don't know what these represent and don't have any meaningful values for them. It seems like I'll need a content provider to use the sync, but that's not how I implemented everything.
Any good links or info on implementing sync with your own code?
You can implement anything you want for your sync needs. Android sync adapter provides a framework for sync'ing which includes states, callbacks, settings, scheduled events, etc. You can use what you need and leave the rest for other apps. There are helper functions that makes it easy to use consistently with the syncing that you find in Accounts & Sync Settings.
The android:contentAuthority is the unique identifier used during the broadcast that your sync adapter would respond to. It is like "com.mycompany.myproject. ...". The flag android:supportsUploading is required for permission to send data out of your application. I believe it is coordinated with some android:uses-permission setting.
I don't think you are required to have a CP, but quite often you would and if you do, it can be really thin to be the authority.

Content Provider is part of my application?

I need to create 3 things:
Content Provider
Service
Application
I'm wondering if these all three will be in one single project, or they will be three different projects?
Also how can I limit my Content Provider to my services and my applications?
Regards,
Pentium10
They would be a single project. They are application framework objects and not as heavyweight as you might currently believe.
As far as permissions, check the security guide
To get more detailled answers maybe you could specify what type of "Content Provider", "Service" and "Application" you 'need' to create - and why..? ..a pay-for-content app..? ..a music-download portal..?

Categories

Resources