18

I have downloaded an application from the android market. I just have to enter a number and on click of enter, that app generates a table with some contents.

I want my application to copy the contents of the table. My application invoked that application. The user has to put the data in the edit text manually and then hit enter. My application would be running in the background till then.

  1. Is this possible?
  2. How?

Another Question: Can i just take a screenshot of the 2nd application's screen and then use a image to text decoder to get the data on that screen?

PrincessLeiha
  • 3,144
  • 4
  • 32
  • 53
  • Hello, I need the exact same solution as you have asked in this question, have you got something on this or know? – mnrafg Feb 22 '21 at 16:31
  • hey, no, it was not possible then. The text decoders that were available then could not convert the exact image to text. There were a lot of problems. – PrincessLeiha Feb 26 '21 at 05:18

4 Answers4

7

There are two ways:

1) Intent: If you want to share small amounts of text or numeric data between apps, you should send an Intent that contains the data.

2) Content provider: To offer a file from your app to another app is to send the receiving app the file's content URI and grant temporary access permissions to that URI. Content URIs with temporary URI access permissions are secure because they apply only to the app that receives the URI, and they expire automatically.

Da Ha Song
  • 398
  • 5
  • 11
4

Here is full documentation about data storage and data sharing between apps. I doubt you can share database, but you can try do the same by using external storage

Jin35
  • 8,602
  • 3
  • 32
  • 52
  • This application is not mine, so i don't even know where the database lies, where all the data is stored. In that case, what do i do? – PrincessLeiha Dec 12 '11 at 08:02
  • I suppose you cant achieve any private data of other app. If third party app wants to share any data - it uses methods, described in documentation – Jin35 Dec 12 '11 at 08:05
4

It seems that you want to pass some data to that app and run it,right? It's possible if and only if that app provides some "hooks" for you to do that.

In Android, you can, no matter whether an app provides any hooks for you or not, start an app by doing something like this:

Intent intent=new Intent();
intent.setPackage(TARGET_APP's package name);
context.startActivity(intent);

This should start that app, however, if it doesn't provide hooks for you, that app will run as it normally runs. In that case ,you data won't take effect. If it provides hooks, you can put data via intent.putExtra("KEy",value) and then start that app.

On the other hand, if you want to read some data from an app, it's possible if and only if that app allows you to do so. Data generated by the app is private by default.

Huang
  • 4,812
  • 3
  • 21
  • 20
  • Thanks for your answer, I have written the code to start the application and it's working fine, but i need to access the data. I am not able to do that. – PrincessLeiha Dec 12 '11 at 09:28
  • if that app doesn't design a mechanism for some third apps to pass data, it's impossible to do so. – Huang Dec 12 '11 at 10:22
  • Sorry, I dont' think would be. – Huang Dec 12 '11 at 12:00
  • 1
    Are we allowed to take screen shots? I searched the net, and got the results like "device needs to be rooted". I think the 2nd option to this would be, take a screen shot and then convert the image to text! Would this be possible? – PrincessLeiha Dec 12 '11 at 12:20
  • 1
    Inside your own app, you can take screenshots without root, if you want to take screenshots at any time, the phone has to be rooted.Even that works, reading out texts directly from graphics is difficult, without your intervene, I think. What function do you need from that app? perhaps you can search for some open-source jar as an alternative. – Huang Dec 12 '11 at 15:45
  • from a 3rd party application, i want to read the contents of a table that are displayed. The contents are not editable. So I can't use the copy, paste option. – PrincessLeiha Dec 13 '11 at 06:41
  • As I said, you can take a screenshot and read the content manually, but it's hard to make your app to archieve this automatically. I suggest you write your own codes or import some third party libraries to generate the same content. – Huang Dec 13 '11 at 07:03
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/5800/discussion-between-pallavi-and-huang) – PrincessLeiha Dec 13 '11 at 07:50
2

Android sandboxes individual applications, so you can only interact with other apps through their exposed services - intents and content providers. Being rooted almost definitely won't help here.

Being able to obtain data from a third party app you know nothing about is likely to be impossible, and taking a screen shot messy and unreliable even if it is possible.

Why not contact the developer and explain what you want to do, to see if they will provide a sensible way for you to obtain the data from their app?

Phil Haigh
  • 4,522
  • 1
  • 25
  • 29