Android Question sharing data between apps

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
hi

just came across this wonderful post

this is exactly what i was searching for long time

one question: will it be accepted by google play store?

thanks
 
Solution
OK
i think issue solved
i've uploaded 2 test apps to google play as internal beta
google accepted them and they're working
so i think issue is solved now

thank you all for the good will and assistance

peacemaker

Expert
Licensed User
Longtime User
Sorry for offtopic comment: i have no idea, but bet that no.
Google has so many rules that how and who can be sure...
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
have you tried with FileProvider library ?
no i did not
i was looking for long time for such a solution and here i found it
if google will accept it - why not use it as is?
so simple and clear...

if not - is there a sample for that fileProvider?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
is there a sample for that fileProvider?
Sure. Like always a Example is in the FileProvider-Librarythread.

Start looking/searching for it first and then, if you are not able to find it, post a question.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Do a search or scroll down to the similar threads at the bottom. Check the last one.
thanks
did look and try the sample @Erel mentioned
as far as i see it uses a private folder to store the file so another app can't access it
what i need is a solution that i can create a shared folder for two apps and share files using that folder
that's why the sample was so good for my needs
if google play will accept it then it is a perfect solution for me - exactly what i was looking for
any comment on the google play issue?
or is there a way to set the common folder in the sample suggested here?
thanks
 
Upvote 0

Cliff McKibbin

Member
Licensed User
Passing a file back and forth between two apps on the same device is possible but has several issues:
1. If you hard code the directory and file name to avoid manual intervention, things might break in the future.
2. Google Android may take away features in the future. It is apparently already not happy with the solution suggested above.
3. There is an issue as to how to handle the hand-shake between the two apps.
For instance, what if you don't process the last text file with app 'B' before creating or writing over the text file with a new entry from 'A'

The approach to syncing databases provided by Erel for your own web server in:

or my adaptation of it for a 'hosted server" in:

each give you another option that you might use to pass data between different apps on the same device.

Both of these were built to pass DB update transactions between the same app on different devices.
They both use a remote server to store the transaction until it can be read by the app on the other devices. However, there is no reason that it can't be different apps on the same device. As to speed, I have seen my apps read 150 records and update the database in under a second, so your single record will be no problem. You can update a DB or just use the record to process your next step.

In my example, you:
1. Define a 'group Id' and 'Individual Id'. In your case, this would be a unique Id for the device and individual ids, 'A', 'B', and 'C'. You would save the same 'group Id' into each app for the particular device; you could even use the phone number as the 'group-id'. The apps would also store their 'individual Id': 'A', 'B', or 'C'.
2. Outgoing transactions send their data to the server using a prebuilt https command and are sent to each of the 'Individual Ids' for the 'Group Id'. In your case 'A' would send to 'B' and 'C'.
3. When 'B' becomes active, it issues an https command to read any transactions intended for it.
4. When the result has been received and successfully processed, it sends another https command to delete the entry.
5. Ditto for 'C'.

The documentation provided discusses:
1. How to build the php routines for the hosted server.
2. How to make the http calls.
3. Approach to buffering the output to handle a situation where the communication link is temporarily lost during the 'send' operation.
4. Approach to assuring the data is not lost if there is interruption during the download.
5. Eliminating SQL injection issues.

In addition, you will have to decide how to 'fire' the https read operation in 'B' and 'C'. This could be as simple as firing it at load time in starter or b4xmainpage; firing it at ' B4xPage_Appear' time, or even adding a button to 'Read transaction'.

Good luck with your project.
Cliff McKibbin
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Passing a file back and forth between two apps on the same device is possible but has several issues:
1. If you hard code the directory and file name to avoid manual intervention, things might break in the future.
2. Google Android may take away features in the future. It is apparently already not happy with the solution suggested above.
3. There is an issue as to how to handle the hand-shake between the two apps.
For instance, what if you don't process the last text file with app 'B' before creating or writing over the text file with a new entry from 'A'

The approach to syncing databases provided by Erel for your own web server in:

or my adaptation of it for a 'hosted server" in:

each give you another option that you might use to pass data between different apps on the same device.

Both of these were built to pass DB update transactions between the same app on different devices.
They both use a remote server to store the transaction until it can be read by the app on the other devices. However, there is no reason that it can't be different apps on the same device. As to speed, I have seen my apps read 150 records and update the database in under a second, so your single record will be no problem. You can update a DB or just use the record to process your next step.

In my example, you:
1. Define a 'group Id' and 'Individual Id'. In your case, this would be a unique Id for the device and individual ids, 'A', 'B', and 'C'. You would save the same 'group Id' into each app for the particular device; you could even use the phone number as the 'group-id'. The apps would also store their 'individual Id': 'A', 'B', or 'C'.
2. Outgoing transactions send their data to the server using a prebuilt https command and are sent to each of the 'Individual Ids' for the 'Group Id'. In your case 'A' would send to 'B' and 'C'.
3. When 'B' becomes active, it issues an https command to read any transactions intended for it.
4. When the result has been received and successfully processed, it sends another https command to delete the entry.
5. Ditto for 'C'.

The documentation provided discusses:
1. How to build the php routines for the hosted server.
2. How to make the http calls.
3. Approach to buffering the output to handle a situation where the communication link is temporarily lost during the 'send' operation.
4. Approach to assuring the data is not lost if there is interruption during the download.
5. Eliminating SQL injection issues.

In addition, you will have to decide how to 'fire' the https read operation in 'B' and 'C'. This could be as simple as firing it at load time in starter or b4xmainpage; firing it at ' B4xPage_Appear' time, or even adding a button to 'Read transaction'.

Good luck with your project.
Cliff McKibbin
thank you so much Cliff for your super detailed reply
i think some of it is not relevant for my needs - i do not need to share DB but a simple text file
there is no issue of sync as appA creates the file and then run appB being put on hold until appB is done
appB reads the file and so with it something then writes the results in the same file and exit bringing appA back to life to continue exactly where is was and go on reading the file
so basically it's the most primitive mechanism to pass data between 2 apps
if something goes wrong on the way no harm is done
it did test it in debug mode and runtime mode on my environment and it looks like perfect solution
yes - the file name and folder name are hardcoded in both apps as it is a must be to enable this to work and of course it's always the same folder and same file
so my issue is simply one - will it pass google play?

currently i use my web server to store the file so it is being uploaded and downloaded be each app
the problem with this method is that it might take "time" - currently is does not but i want a local primitive way which i think should have less issues

what do you think?

thanks
Zeev
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
The answer is simply just do it and see what happens? Maybe you are lucky your app would pass by Google. Who knows?
truth? i just thought the same thing
i will add it to my app as dead code - not using it and keep the old way
if google will take it than i will update again and use this method
i even think to keep both way - use this new one and it fails to use as alternate method the old one
back to stone age...

thank you all for your good will
Z
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
truth? i just thought the same thing
i will add it to my app as dead code - not using it and keep the old way
if google will take it than i will update again and use this method
i even think to keep both way - use this new one and it fails to use as alternate method the old one
back to stone age...

thank you all for your good will
Z
I can't sure whether Google allows it. I think you can just upload a test app and see whether it pass the review. If it doesn't then just forget about it. You can unpublish the test app anytime. Don't touch your existing production app.

Edit: By the way, it is actually 2 apps. Try to add more features or reasons that can convince the reviewer they are useful apps. ?
 
Upvote 0

divinglog

Member
Licensed User
Longtime User
There is the Google Nearby Share API (now Quick Share). I've already created a wrapper library for B4A and I'm planning to release it. It is very easy to share small and large amounts of data between apps on different devices.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
There is the Google Nearby Share API (now Quick Share). I've already created a wrapper library for B4A and I'm planning to release it. It is very easy to share small and large amounts of data between apps on different devices.
nice
it will be nice to see it
however my issue was was on SAME device
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
OK
i think issue solved
i've uploaded 2 test apps to google play as internal beta
google accepted them and they're working
so i think issue is solved now

thank you all for the good will and assistance
 
Upvote 0
Solution
Top