How to get direct access to files on your mobile phone from a native mobile app

How to get direct access to files on your mobile phone from a native mobile app

By: BigPig

2024-03-28 23:02
last edited: 2024-03-29 02:45

I want to directly access files on my mobile device and load data from files to app.
In other words, I want to load file data without UI file selection.

This is because files are created with specific rules in a specific location.
I am thinking about making a project with WEM Native APP if a method approach is possible.
However, as far as I know, I can't catch any way.
I want to directly access files on my mobile device and load data from files to App.
In other words, I want to load file data without UI file selection.
I am thinking about making a project with WEM Native APP if a method approach is possible.
However, as far as I know, I can't catch any way.
Therefore, if there is a way to solve the problem, I would like to do the project right away, if not, I would like to cancel the project.
Please give me a quick guide.

iamkoreanMin

Sort by

Re: How to get direct access to files on your mobile phone from a native mobile app

By: RalphC (WEM)

2024-03-29 09:05
last edit: 2024-03-29 09:59

Moderator

It very much depends on where these files actually are. 

  • Files are part of the Project: stored in the Files Library, files are part of the build that will eventually end up on the mobile device installing the app. You can then access these files in flow logic by using concepts with file concept property that links to the file in the library. Look at https://forum.wem.io/link?threadid=72 for an example approach (used for a different use case but the result is the same: access files in library in flow logic). The only type of file that will not work, is XML unfortunately. But JSON can be used as file and easily implemented in flow logic using the Import JSON node.
  • You can also make those files available from a "management project" built in WEM, where you store the files in the same way (File Library) and make accessible through Concepts with File property, and let the App retrieve the file via Exposed Webservice (REST/JSON) from that project. You can then also have the "management project" use a database list to store the files so you can manage versions of the file etc. depending on your usecase. Look at the Quick Starter Projects in MyWEM: Example Basic Mobile Apps and Example Service Provider, which do provide examples for this situation.

Other files that are not within the scope of the app itself (either part of the app as File Library file, or retrievable via webservice from another project) can not be accessed directly without user interaction (security situation), but if your use case can match any of the aforementioned approaches, you should be able to work it out.

EDIT (approach):

By the way, this approach for accessing files in file library via concept with file-property for use in expressions, flow logic, settings in design template, is applicable to all types of projects - not just native mobile.

EDIT (native mobile):

Adding a file into the File Library will make it part of the app package to be installed on mobile devices, so it will be making the package larger and updating the file will require a new install - consider the second approach where you manage the file and its properties from a web-project and have the app fetch it as needed via exposed rest/json service from that web-project. That will make the app install package smaller and will not require an app-update when the file needs to be changed...  

Ralph - WEM Xpert since 2011

"I speak to machines with the voice of humanity"
-- Marillion, Man of a thousand faces --

Re: How to get direct access to files on your mobile phone from a native mobile app

By: BigPig

2024-03-31 20:33

I saw your answer.
However, that doesn't help at all, and that's what I know about it and it doesn't seem to be the answer to the question I asked, what I was trying to do was ask if I could read the application a dynamically periodically generated external file at a fixed mobile device folder.
From what I reviewed, I think WEM native would be impossible, so this is a question that I'm checking. I don't want to create a project that I can't take responsibility for.

iamkoreanMin

Re: How to get direct access to files on your mobile phone from a native mobile app

By: RalphC (WEM)

2024-03-31 22:14

Moderator

As my first answer already stated, you cannot access files on device which are not part of app context.

This is a security issue and will (or should anyway) also be impossible from apps built another way. Files outside of app direct context can only be accessed via active user interaction - this is really a general security situation - nobody should want to have an app that can access files on their device without active user interaction (not unless the files are part of app direct context or part of app). It is not WEM specific. 

Now, if the file you need is at least actively selected by user in an initial interaction, you can store it within the app context, using persistent list with a file field. That will make the file part of the app so next time your app is started it can access the file directly without user interaction. But it has to be selected by user via browse (file input field) and then stored in the app using the persistent list.

Ralph - WEM Xpert since 2011

"I speak to machines with the voice of humanity"
-- Marillion, Man of a thousand faces --

wemscore 448 , 40 views, 3 replies

Direct link to this thread