[android-developers] Re: How to share data between applications with no dependency

2010-09-20 Thread ayanir
Dianne, it will be great if I can use any other way as long it will:
1. be accessible for both apps no mater which of them installed first
2. will "survive" uninstall

Adam, I can't use cloud because of security reasons: the first app
being installed saves kind of a "login" details for both of the apps.
The only way I can use cloud was if a device could have unique
identification but you can't achieve that on Android :(
Also, both apps can change that data and I want to keep a single
instance of it without a copy.

ayanir

On Sep 20, 12:10 am, Adam Hammer  wrote:
> You could use network/cloud storage for this instead of SD. Depending
> on how much data you are talking it's a feasible alternative.
>
> Adam
>
> On Sep 19, 5:12 am, ayanir  wrote:
>
> > Hello,
>
> > I want to share data between 2 applications.
> > the idea is both applications can write and read the SAME data and
> > there is no dependency which one of the apps is installed or first
> > created the data. I have 2 version of the same app: regular and
> > premium and I don't know which of them will be first installed and
> > both of them can change it.
>
> > I tried to use ContentProvider but the problem is that only the first
> > app can create the Provider and when it is uninstalled it deletes that
> > custom Provider. I want the Content to be kept for the second app.
> > Also, I tried to use Settings.System which keeps the data regardless
> > if the application is installed or not but I don't want to use the
> > permission for that (it is very problematic from user perspective).
> > BTW, it seems that I can change ANY of the Settings.System which is
> > not secured from Android OS perspective - but this is a subject for
> > other post.
>
> > I see only one left choice using a File for that but, I wanted to know
> > if I can use another way?
>
> > Thanks,
> > ayanir

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to share data between applications with no dependency

2010-09-20 Thread ayanir
Dianne, it will be great if I can use any other way as long it will:
1. be accessible for both apps no mater which of them installed first
2. will "survive" uninstall

Adam, I can't use cloud because of security reasons: the first app
being installed saves kind of a "login" details for both of the apps.
The only way I can use cloud was if a device could have unique
identification but you can't achieve that on Android :(
Also, both apps can change that data and I want to keep a single
instance of it without a copy.

ayanir

On Sep 20, 12:10 am, Adam Hammer  wrote:
> You could use network/cloud storage for this instead of SD. Depending
> on how much data you are talking it's a feasible alternative.
>
> Adam
>
> On Sep 19, 5:12 am, ayanir  wrote:
>
> > Hello,
>
> > I want to share data between 2 applications.
> > the idea is both applications can write and read the SAME data and
> > there is no dependency which one of the apps is installed or first
> > created the data. I have 2 version of the same app: regular and
> > premium and I don't know which of them will be first installed and
> > both of them can change it.
>
> > I tried to use ContentProvider but the problem is that only the first
> > app can create the Provider and when it is uninstalled it deletes that
> > custom Provider. I want the Content to be kept for the second app.
> > Also, I tried to use Settings.System which keeps the data regardless
> > if the application is installed or not but I don't want to use the
> > permission for that (it is very problematic from user perspective).
> > BTW, it seems that I can change ANY of the Settings.System which is
> > not secured from Android OS perspective - but this is a subject for
> > other post.
>
> > I see only one left choice using a File for that but, I wanted to know
> > if I can use another way?
>
> > Thanks,
> > ayanir

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to share data between applications with no dependency

2010-09-20 Thread ayanir
Dianne, it will be great if I can use any other way as long it will:
1. be accessible for both apps no mater which of them installed first
2. will "survive" uninstall

Adam, I can't use cloud because of security reasons: the first app
being installed saves kind of a "login" details for both of the apps.
The only way I can use cloud was if a device could have unique
identification but you can't achieve that on Android :(
Also, both apps can change that data and I want to keep a single
instance of it without a copy.

ayanir

On Sep 20, 12:10 am, Adam Hammer  wrote:
> You could use network/cloud storage for this instead of SD. Depending
> on how much data you are talking it's a feasible alternative.
>
> Adam
>
> On Sep 19, 5:12 am, ayanir  wrote:
>
> > Hello,
>
> > I want to share data between 2 applications.
> > the idea is both applications can write and read the SAME data and
> > there is no dependency which one of the apps is installed or first
> > created the data. I have 2 version of the same app: regular and
> > premium and I don't know which of them will be first installed and
> > both of them can change it.
>
> > I tried to use ContentProvider but the problem is that only the first
> > app can create the Provider and when it is uninstalled it deletes that
> > custom Provider. I want the Content to be kept for the second app.
> > Also, I tried to use Settings.System which keeps the data regardless
> > if the application is installed or not but I don't want to use the
> > permission for that (it is very problematic from user perspective).
> > BTW, it seems that I can change ANY of the Settings.System which is
> > not secured from Android OS perspective - but this is a subject for
> > other post.
>
> > I see only one left choice using a File for that but, I wanted to know
> > if I can use another way?
>
> > Thanks,
> > ayanir

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread Adam Hammer
You could use network/cloud storage for this instead of SD. Depending
on how much data you are talking it's a feasible alternative.

Adam

On Sep 19, 5:12 am, ayanir  wrote:
> Hello,
>
> I want to share data between 2 applications.
> the idea is both applications can write and read the SAME data and
> there is no dependency which one of the apps is installed or first
> created the data. I have 2 version of the same app: regular and
> premium and I don't know which of them will be first installed and
> both of them can change it.
>
> I tried to use ContentProvider but the problem is that only the first
> app can create the Provider and when it is uninstalled it deletes that
> custom Provider. I want the Content to be kept for the second app.
> Also, I tried to use Settings.System which keeps the data regardless
> if the application is installed or not but I don't want to use the
> permission for that (it is very problematic from user perspective).
> BTW, it seems that I can change ANY of the Settings.System which is
> not secured from Android OS perspective - but this is a subject for
> other post.
>
> I see only one left choice using a File for that but, I wanted to know
> if I can use another way?
>
> Thanks,
> ayanir

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread Dianne Hackborn
On Sun, Sep 19, 2010 at 7:32 AM, ayanir  wrote:

> I'll go with the file on external storage.
> I think that there should be a general system ContentProvider for that
> exact purpose - I could only hope it will be one day...
>

Why?  There is already external storage which is a mess enough.  Why add
another place for applications to throw random uncontrolled junk in?

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread ayanir
Thanks, it worked like a charm.


On Sep 19, 4:39 pm, Mark Murphy  wrote:
> On Sun, Sep 19, 2010 at 10:32 AM, ayanir  wrote:
> > I think that there should be a general system ContentProvider for that
> > exact purpose - I could only hope it will be one day...
>
> I rather doubt that will happen, at least in terms of the core OS.
> Android is very determined to avoid applications leaving crap behind,
> even if, in your case, that "crap" is intentional.
>
> > could you please refer me to an example how to create/read a file
> > using the external storage?
>
> Add the WRITE_EXTERNAL_STORAGE permission to your app. Use
> Environment.getExternalStorageDirectory() to get the path to external
> storage. From there, it is standard Java I/O to read and write files.
>
> Use Environment.getExternalStorageState() and the ACTION_MEDIA_
> broadcast Intents to monitor when external storage is available. Note
> that, since the user can mount external storage on a host computer,
> external storage is not available 100% of the time.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in London:http://skillsmatter.com/go/os-mobile-server

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread Mark Murphy
On Sun, Sep 19, 2010 at 10:32 AM, ayanir  wrote:
> I think that there should be a general system ContentProvider for that
> exact purpose - I could only hope it will be one day...

I rather doubt that will happen, at least in terms of the core OS.
Android is very determined to avoid applications leaving crap behind,
even if, in your case, that "crap" is intentional.

> could you please refer me to an example how to create/read a file
> using the external storage?

Add the WRITE_EXTERNAL_STORAGE permission to your app. Use
Environment.getExternalStorageDirectory() to get the path to external
storage. From there, it is standard Java I/O to read and write files.

Use Environment.getExternalStorageState() and the ACTION_MEDIA_
broadcast Intents to monitor when external storage is available. Note
that, since the user can mount external storage on a host computer,
external storage is not available 100% of the time.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://skillsmatter.com/go/os-mobile-server

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread ayanir
Thank you Mark.

I'll go with the file on external storage.
I think that there should be a general system ContentProvider for that
exact purpose - I could only hope it will be one day...

Prakash - you solution of installing a third app which contains the
ContentProvider is not really an option for me but thanks.

could you please refer me to an example how to create/read a file
using the external storage?

thanks'
ayanir


On Sep 19, 4:09 pm, DanH  wrote:
> Can an application not place images or music in directories on the
> device, and have those files persist beyond the persistence of the
> app?
>
> On Sep 19, 7:23 am, Mark Murphy  wrote:
>
> > On Sun, Sep 19, 2010 at 8:12 AM, ayanir  wrote:
> > > I want to share data between 2 applications.
> > > the idea is both applications can write and read the SAME data and
> > > there is no dependency which one of the apps is installed or first
> > > created the data. I have 2 version of the same app: regular and
> > > premium and I don't know which of them will be first installed and
> > > both of them can change it.
>
> > That will be difficult.
>
> > > I tried to use ContentProvider but the problem is that only the first
> > > app can create the Provider and when it is uninstalled it deletes that
> > > custom Provider.
>
> > Correct.
>
> > > I want the Content to be kept for the second app.
>
> > That is only possible if you store it on external storage.
>
> > > Also, I tried to use Settings.System which keeps the data regardless
> > > if the application is installed or not but I don't want to use the
> > > permission for that (it is very problematic from user perspective).
>
> > I have no idea what you are talking about.
>
> > > BTW, it seems that I can change ANY of the Settings.System which is
> > > not secured from Android OS perspective - but this is a subject for
> > > other post.
>
> > Correct. The secure ones are in Settings.Secure.
>
> > > I see only one left choice using a File for that but, I wanted to know
> > > if I can use another way?
>
> > A file on external storage is the only thing that survives an
> > uninstall and is reachable by two applications.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android Training in London:http://skillsmatter.com/go/os-mobile-server

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread Prakash Iyer
Yes. That's what I interpreted the OP saying when he says File is an option
but he's looking for alternatives.

On Sep 19, 2010 10:10 AM, "DanH"  wrote:

Can an application not place images or music in directories on the
device, and have those files persist beyond the persistence of the
app?

On Sep 19, 7:23 am, Mark Murphy  wrote:

> On Sun, Sep 19, 2010 at 8:12 AM, ayanir  wrote:
> > I want to share data betw...
> Mark Murphy (a Commons Guy)http://commonsware.com|
http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

>
> Android Training in London:http://skillsmatter.com/go/os-mobile-server

-- 
You received this me...

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread Mark Murphy
On Sun, Sep 19, 2010 at 10:09 AM, DanH  wrote:
> Can an application not place images or music in directories on the
> device, and have those files persist beyond the persistence of the
> app?

On external storage, yes. In the directory obtained via getFilesDir()
(/data/data/your.package.here/files), no. The whole
/data/data/your.package.here directory is deleted on uninstall.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://skillsmatter.com/go/os-mobile-server

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to share data between applications with no dependency

2010-09-19 Thread DanH
Can an application not place images or music in directories on the
device, and have those files persist beyond the persistence of the
app?

On Sep 19, 7:23 am, Mark Murphy  wrote:
> On Sun, Sep 19, 2010 at 8:12 AM, ayanir  wrote:
> > I want to share data between 2 applications.
> > the idea is both applications can write and read the SAME data and
> > there is no dependency which one of the apps is installed or first
> > created the data. I have 2 version of the same app: regular and
> > premium and I don't know which of them will be first installed and
> > both of them can change it.
>
> That will be difficult.
>
> > I tried to use ContentProvider but the problem is that only the first
> > app can create the Provider and when it is uninstalled it deletes that
> > custom Provider.
>
> Correct.
>
> > I want the Content to be kept for the second app.
>
> That is only possible if you store it on external storage.
>
> > Also, I tried to use Settings.System which keeps the data regardless
> > if the application is installed or not but I don't want to use the
> > permission for that (it is very problematic from user perspective).
>
> I have no idea what you are talking about.
>
> > BTW, it seems that I can change ANY of the Settings.System which is
> > not secured from Android OS perspective - but this is a subject for
> > other post.
>
> Correct. The secure ones are in Settings.Secure.
>
> > I see only one left choice using a File for that but, I wanted to know
> > if I can use another way?
>
> A file on external storage is the only thing that survives an
> uninstall and is reachable by two applications.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android Training in London:http://skillsmatter.com/go/os-mobile-server

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en