Can I install the app on my phone but store the .mmpk files on the external storage card? If so how do I point to this new location?
This is weird. The path seems good, what is the make and model of the phone you are testing? OS version?
OK I added the code below to try and get the path....downloaded to my phone and the results are below.
Note the results are printed 2 times via the For Loop
RESULTS ON PHONE:
pathTV is: /storage/self /storage/self
fsTV is: tmpfstmpfs
devTV is: tmpfstmpfs
urlTV is: /storage/selffile:///storage/self
fileFTV is: /storage/selfundefined
STILL DOES not work.....ANY THOUGHTS????
<SPAN class="keyword token">import</SPAN> QtQuick <SPAN class="number token">2.7</SPAN> <SPAN class="keyword token">import</SPAN> QtQuick<SPAN class="punctuation token">.</SPAN>Layouts <SPAN class="number token">1.1</SPAN> <SPAN class="keyword token">import</SPAN> QtQuick<SPAN class="punctuation token">.</SPAN>Controls <SPAN class="number token">2.1</SPAN> <SPAN class="keyword token">import</SPAN> QtQuick<SPAN class="punctuation token">.</SPAN>Controls<SPAN class="punctuation token">.</SPAN>Material <SPAN class="number token">2.1</SPAN> <SPAN class="keyword token">import</SPAN> QtGraphicalEffects <SPAN class="number token">1.0</SPAN> <SPAN class="keyword token">import</SPAN> ArcGIS<SPAN class="punctuation token">.</SPAN>AppFramework <SPAN class="number token">1.0</SPAN> <SPAN class="keyword token">import</SPAN> ArcGIS<SPAN class="punctuation token">.</SPAN>AppFramework<SPAN class="punctuation token">.</SPAN>Controls <SPAN class="number token">1.0</SPAN> <SPAN class="keyword token">import</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime <SPAN class="number token">100.2</SPAN> App <SPAN class="punctuation token">{</SPAN> property <SPAN class="keyword token">var</SPAN> pathTV<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"path"</SPAN> property <SPAN class="keyword token">var</SPAN> fsTV<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"fstv"</SPAN> property <SPAN class="keyword token">var</SPAN> devTV<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"devtv"</SPAN> property <SPAN class="keyword token">var</SPAN> urlTV<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"urltv"</SPAN> property <SPAN class="keyword token">var</SPAN> fileFTV<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"fileFTV"</SPAN> id<SPAN class="punctuation token">:</SPAN> app width<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">400</SPAN> height<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">640</SPAN> Text <SPAN class="punctuation token">{</SPAN> anchors <SPAN class="punctuation token">{</SPAN> top<SPAN class="punctuation token">:</SPAN>parent<SPAN class="punctuation token">.</SPAN>top horizontalCenter<SPAN class="punctuation token">:</SPAN> parent<SPAN class="punctuation token">.</SPAN>horizontalCenter margins<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">20</SPAN> <SPAN class="punctuation token">}</SPAN> text<SPAN class="punctuation token">:</SPAN><SPAN class="string token">"StorageInfo Details"</SPAN> font<SPAN class="punctuation token">.</SPAN>pointSize<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">25</SPAN> <SPAN class="punctuation token">}</SPAN> Text <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN>content2 anchors<SPAN class="punctuation token">.</SPAN>fill<SPAN class="punctuation token">:</SPAN> parent text<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"pathTV is: "</SPAN> <SPAN class="operator token">+</SPAN> pathTV <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n fsTV is: "</SPAN> <SPAN class="operator token">+</SPAN> fsTV <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n devTV is: "</SPAN><SPAN class="operator token">+</SPAN> devTV <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n urlTV is: "</SPAN><SPAN class="operator token">+</SPAN> urlTV <SPAN class="operator token">+</SPAN> <SPAN class="string token">"\n fileFTV is: "</SPAN><SPAN class="operator token">+</SPAN> fileFTV font<SPAN class="punctuation token">.</SPAN>pointSize<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">16</SPAN> color<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"green"</SPAN> wrapMode<SPAN class="punctuation token">:</SPAN> Text<SPAN class="punctuation token">.</SPAN>WrapAtWordBoundaryOrAnywhere horizontalAlignment<SPAN class="punctuation token">:</SPAN> Text<SPAN class="punctuation token">.</SPAN>AlignHCenter verticalAlignment<SPAN class="punctuation token">:</SPAN> Text<SPAN class="punctuation token">.</SPAN>AlignVCenter elide<SPAN class="punctuation token">:</SPAN> Text<SPAN class="punctuation token">.</SPAN>ElideRight anchors<SPAN class="punctuation token">.</SPAN>margins<SPAN class="punctuation token">:</SPAN> <SPAN class="number token">10</SPAN> <SPAN class="punctuation token">}</SPAN> StorageInfo <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN>storageInfo <SPAN class="punctuation token">}</SPAN> Component<SPAN class="punctuation token">.</SPAN>onCompleted<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> pathT<SPAN class="punctuation token">,</SPAN> fsT<SPAN class="punctuation token">,</SPAN> devT<SPAN class="punctuation token">,</SPAN> urlT<SPAN class="punctuation token">,</SPAN> fileFT<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> path<SPAN class="punctuation token">,</SPAN> fs<SPAN class="punctuation token">,</SPAN> dev<SPAN class="punctuation token">,</SPAN> url<SPAN class="punctuation token">,</SPAN> fileF<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> mountedVols <SPAN class="operator token">=</SPAN> storageInfo<SPAN class="punctuation token">.</SPAN>mountedVolumes<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> i <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN> i <SPAN class="operator token"><</SPAN> mountedVols<SPAN class="punctuation token">.</SPAN>length<SPAN class="punctuation token">;</SPAN> i<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> fs <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>fileSystemType<SPAN class="punctuation token">;</SPAN> fsT <SPAN class="operator token">=</SPAN> fs <SPAN class="operator token">+</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>fileSystemType<SPAN class="punctuation token">;</SPAN> dev <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>device devT <SPAN class="operator token">=</SPAN> dev <SPAN class="operator token">+</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>device path <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">;</SPAN> pathT <SPAN class="operator token">=</SPAN> path <SPAN class="operator token">+</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">;</SPAN> url <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>url<SPAN class="punctuation token">;</SPAN> urlT <SPAN class="operator token">=</SPAN> path <SPAN class="operator token">+</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>url<SPAN class="punctuation token">;</SPAN> fileF <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>folder<SPAN class="punctuation token">.</SPAN>FileFolder<SPAN class="punctuation token">.</SPAN>folderName<SPAN class="punctuation token">;</SPAN> fileFT <SPAN class="operator token">=</SPAN> path <SPAN class="operator token">+</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>folder<SPAN class="punctuation token">.</SPAN>FileFolder<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> pathTV <SPAN class="operator token">=</SPAN> <SPAN class="token function">String</SPAN><SPAN class="punctuation token">(</SPAN>pathT<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> fsTV <SPAN class="operator token">=</SPAN> <SPAN class="token function">String</SPAN><SPAN class="punctuation token">(</SPAN>fsT<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> devTV <SPAN class="operator token">=</SPAN> <SPAN class="token function">String</SPAN><SPAN class="punctuation token">(</SPAN>devT<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> urlTV <SPAN class="operator token">=</SPAN> <SPAN class="token function">String</SPAN><SPAN class="punctuation token">(</SPAN>urlT<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> fileFTV <SPAN class="operator token">=</SPAN> <SPAN class="token function">String</SPAN><SPAN class="punctuation token">(</SPAN>fileFT<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
From this I tried to specify the path in the MmpkManager as follows...
Top of the MmpkManager.qml
FileFolder<SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> fileFolder <SPAN class="comment token">// readonly property url storageBasePath: AppFramework.userHomeFolder.fileUrl("ArcGIS/AppStudio/Data")</SPAN> readonly property url storageBasePath<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"/storage/self/ArcGIS/AppStudio/Data"</SPAN> property url storagePath<SPAN class="punctuation token">:</SPAN> subFolder <SPAN class="operator token">&&</SPAN> subFolder<SPAN class="operator token">></SPAN><SPAN class="string token">""</SPAN> <SPAN class="operator token">?</SPAN> storageBasePath <SPAN class="operator token">+</SPAN> <SPAN class="string token">"/"</SPAN> <SPAN class="operator token">+</SPAN> subFolder <SPAN class="punctuation token">:</SPAN> storageBasePath url<SPAN class="punctuation token">:</SPAN> storagePath Component<SPAN class="punctuation token">.</SPAN>onCompleted<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>fileFolder<SPAN class="punctuation token">.</SPAN>exists<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> fileFolder<SPAN class="punctuation token">.</SPAN><SPAN class="token function">makeFolder</SPAN><SPAN class="punctuation token">(</SPAN>storagePath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>fileFolder<SPAN class="punctuation token">.</SPAN><SPAN class="token function">fileExists</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">".nomedia"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">&&</SPAN> Qt<SPAN class="punctuation token">.</SPAN>platform<SPAN class="punctuation token">.</SPAN>os <SPAN class="operator token">===</SPAN> <SPAN class="string token">"android"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> fileFolder<SPAN class="punctuation token">.</SPAN><SPAN class="token function">writeFile</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">".nomedia"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Bottom of the MmpkManager.qml
Component<SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> typeNetworkRequestComponent NetworkRequest<SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> typeNetworkRequest property <SPAN class="keyword token">var</SPAN> callback method<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"GET"</SPAN> ignoreSslErrors<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">true</SPAN> onReadyStateChanged<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>readyState <SPAN class="operator token">===</SPAN> NetworkRequest<SPAN class="punctuation token">.</SPAN>DONE <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN>errorCode <SPAN class="operator token">!=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> root <SPAN class="operator token">=</SPAN> JSON<SPAN class="punctuation token">.</SPAN><SPAN class="token function">parse</SPAN><SPAN class="punctuation token">(</SPAN>responseText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN>root<SPAN class="punctuation token">.</SPAN>type <SPAN class="operator token">==</SPAN> <SPAN class="string token">"Mobile Map Package"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> component <SPAN class="operator token">=</SPAN> networkRequestComponent<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> networkRequest <SPAN class="operator token">=</SPAN> component<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN>parent<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> url <SPAN class="operator token">=</SPAN> rootUrl<SPAN class="operator token">+</SPAN>itemId<SPAN class="operator token">+</SPAN><SPAN class="string token">"/data"</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> fileslocation <SPAN class="operator token">=</SPAN> <SPAN class="string token">"/storage/self/ArcGIS/AppStudio/Data/QuickReport"</SPAN> <SPAN class="keyword token">var</SPAN> path <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>fileslocation<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">join</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"/"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> networkRequest<SPAN class="punctuation token">.</SPAN><SPAN class="token function">downloadFile</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">,</SPAN> url<SPAN class="punctuation token">,</SPAN> path<SPAN class="punctuation token">,</SPAN> typeNetworkRequest<SPAN class="punctuation token">.</SPAN>callback<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="token function">checkType</SPAN><SPAN class="punctuation token">(</SPAN>url<SPAN class="punctuation token">,</SPAN> callback<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> typeNetworkRequest<SPAN class="punctuation token">.</SPAN>url <SPAN class="operator token">=</SPAN> url<SPAN class="punctuation token">;</SPAN> typeNetworkRequest<SPAN class="punctuation token">.</SPAN>callback <SPAN class="operator token">=</SPAN> callback<SPAN class="punctuation token">;</SPAN> typeNetworkRequest<SPAN class="punctuation token">.</SPAN><SPAN class="token function">send</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Fantastic...this uncovered I had the path incorrect the whole time....going to give this a shot....
THANKS
Jay,
The path to external storage card on every device and platform can be varied.
The best way to get the path to the external storage card (if present, I am assuming Android?) is by using the StorageInfo plugin from AppStudio AppFramework.
For example like this,
StorageInfo <SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> storageInfo <SPAN class="punctuation token">}</SPAN> Component<SPAN class="punctuation token">.</SPAN>onCompleted<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> path<SPAN class="punctuation token">,</SPAN> fs<SPAN class="punctuation token">,</SPAN> dev<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> mountedVols <SPAN class="operator token">=</SPAN> storageInfo<SPAN class="punctuation token">.</SPAN>mountedVolumes<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> i <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN> i <SPAN class="operator token"><</SPAN> mountedVols<SPAN class="punctuation token">.</SPAN>length<SPAN class="punctuation token">;</SPAN> i<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> fs <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>fileSystemType<SPAN class="punctuation token">;</SPAN> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"file system type: "</SPAN><SPAN class="punctuation token">,</SPAN> fs<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> dev <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>device console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"device: "</SPAN><SPAN class="punctuation token">,</SPAN> dev<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> path <SPAN class="operator token">=</SPAN> mountedVols<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">;</SPAN> console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"path: "</SPAN><SPAN class="punctuation token">,</SPAN> path<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
The path to the storage card normally starts with "/storage/..." or "/mnt/...
Thank you,
Erwin
Has anyone done this before.....I got this to work when I changed it to the C:/Temp/Test on my PC....but still cant get it to my phone storage card. The below first two examples show how I did this to my C Drive.
In the MmpkManager.qml file at the bottom if I change the readonly property url to the below nothing happens...
onReadyStateChanged<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>readyState <SPAN class="operator token">===</SPAN> NetworkRequest<SPAN class="punctuation token">.</SPAN>DONE <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN>errorCode <SPAN class="operator token">!=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> root <SPAN class="operator token">=</SPAN> JSON<SPAN class="punctuation token">.</SPAN><SPAN class="token function">parse</SPAN><SPAN class="punctuation token">(</SPAN>responseText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN>root<SPAN class="punctuation token">.</SPAN>type <SPAN class="operator token">==</SPAN> <SPAN class="string token">"Mobile Map Package"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> component <SPAN class="operator token">=</SPAN> networkRequestComponent<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> networkRequest <SPAN class="operator token">=</SPAN> component<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN>parent<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> url <SPAN class="operator token">=</SPAN> rootUrl<SPAN class="operator token">+</SPAN>itemId<SPAN class="operator token">+</SPAN><SPAN class="string token">"/data"</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// ADDED</SPAN> <SPAN class="keyword token">var</SPAN> fileslocation <SPAN class="operator token">=</SPAN> <SPAN class="string token">"C:/Temp/tEST/QuickReport"</SPAN> <SPAN class="comment token">// COMMENTED OUT</SPAN> <SPAN class="comment token">//var path = [fileFolder.path, "~"+itemName].join("/");</SPAN> <SPAN class="comment token">// MODIFIED THE ABOVE TO THIS</SPAN> <SPAN class="keyword token">var</SPAN> path <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>fileslocation<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">join</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"/"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> networkRequest<SPAN class="punctuation token">.</SPAN><SPAN class="token function">downloadFile</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">,</SPAN> url<SPAN class="punctuation token">,</SPAN> path<SPAN class="punctuation token">,</SPAN> typeNetworkRequest<SPAN class="punctuation token">.</SPAN>callback<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
If I then go to the top of the MmpkManager.qml file and change the below it no uses the C drive and shows the mmpk file through AppStudio when I run the project.
I have to make both changes to get it to work
FileFolder<SPAN class="punctuation token">{</SPAN> id<SPAN class="punctuation token">:</SPAN> fileFolder <SPAN class="comment token">// COMMENTED OUT</SPAN> <SPAN class="comment token">//readonly property url storageBasePath: AppFramework.userHomeFolder.fileUrl("ArcGIS/AppStudio/Data")</SPAN> <SPAN class="comment token">// MODIFIED TO THIS</SPAN> <SPAN class="comment token">// THIS WORKS ON THE DESKTOP</SPAN> readonly property url storageBasePath<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"C:/Temp/tEST"</SPAN> property url storagePath<SPAN class="punctuation token">:</SPAN> subFolder <SPAN class="operator token">&&</SPAN> subFolder<SPAN class="operator token">></SPAN><SPAN class="string token">""</SPAN> <SPAN class="operator token">?</SPAN> storageBasePath <SPAN class="operator token">+</SPAN> <SPAN class="string token">"/"</SPAN> <SPAN class="operator token">+</SPAN> subFolder <SPAN class="punctuation token">:</SPAN> storageBasePath url<SPAN class="punctuation token">:</SPAN> storagePath Component<SPAN class="punctuation token">.</SPAN>onCompleted<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>fileFolder<SPAN class="punctuation token">.</SPAN>exists<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> fileFolder<SPAN class="punctuation token">.</SPAN><SPAN class="token function">makeFolder</SPAN><SPAN class="punctuation token">(</SPAN>storagePath<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="operator token">!</SPAN>fileFolder<SPAN class="punctuation token">.</SPAN><SPAN class="token function">fileExists</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">".nomedia"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">&&</SPAN> Qt<SPAN class="punctuation token">.</SPAN>platform<SPAN class="punctuation token">.</SPAN>os <SPAN class="operator token">===</SPAN> <SPAN class="string token">"android"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> fileFolder<SPAN class="punctuation token">.</SPAN><SPAN class="token function">writeFile</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">".nomedia"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
If I make the two above changes it works....I am then trying to modify that so I can use on my Phones SD Card and nothing works....
My question is am on on the right path? Are there any other modifications that I need to make to the code to get this to work?
I then try this...to get to the storage card
At the top of the MmpkManager.qml
readonly property url storageBasePath<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"/storage/Test"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
At the bottom of the MmpkManager.qml
<SPAN class="keyword token">var</SPAN> fileslocation <SPAN class="operator token">=</SPAN> <SPAN class="string token">"/storage/Test/QuickReport"</SPAN> <SPAN class="keyword token">var</SPAN> path <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>fileslocation<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">join</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"/"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> networkRequest<SPAN class="punctuation token">.</SPAN><SPAN class="token function">downloadFile</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">,</SPAN> url<SPAN class="punctuation token">,</SPAN> path<SPAN class="punctuation token">,</SPAN> typeNetworkRequest<SPAN class="punctuation token">.</SPAN>callback<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Any one have any thoughts?
In the MmpkManager.qml file
I added line 13
commented line 15
added/modified line 16
I uploaded and did a make on the project....I downloaded and installed from AGOL and when I went offline it still saved the download to the Phone itself and not the SD Card:
SAMSUNG-SM-J727V\Phone\ArcGIS\AppStudio\Data\QuickReport
Am I missing something?
onReadyStateChanged<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>readyState <SPAN class="operator token">===</SPAN> NetworkRequest<SPAN class="punctuation token">.</SPAN>DONE <SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN>errorCode <SPAN class="operator token">!=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">var</SPAN> root <SPAN class="operator token">=</SPAN> JSON<SPAN class="punctuation token">.</SPAN><SPAN class="token function">parse</SPAN><SPAN class="punctuation token">(</SPAN>responseText<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">if</SPAN><SPAN class="punctuation token">(</SPAN>root<SPAN class="punctuation token">.</SPAN>type <SPAN class="operator token">==</SPAN> <SPAN class="string token">"Mobile Map Package"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> component <SPAN class="operator token">=</SPAN> networkRequestComponent<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> networkRequest <SPAN class="operator token">=</SPAN> component<SPAN class="punctuation token">.</SPAN><SPAN class="token function">createObject</SPAN><SPAN class="punctuation token">(</SPAN>parent<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> url <SPAN class="operator token">=</SPAN> rootUrl<SPAN class="operator token">+</SPAN>itemId<SPAN class="operator token">+</SPAN><SPAN class="string token">"/data"</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> fileslocation <SPAN class="operator token">=</SPAN> <SPAN class="string token">"/mnt/sdcard/ArcGIS/AppStudio/Data/QuickReport/"</SPAN> <SPAN class="comment token">//var path = [fileFolder.path, "~"+itemName].join("/");</SPAN> <SPAN class="keyword token">var</SPAN> path <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN>fileslocation<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">join</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"/"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> networkRequest<SPAN class="punctuation token">.</SPAN><SPAN class="token function">downloadFile</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"~"</SPAN><SPAN class="operator token">+</SPAN>itemName<SPAN class="punctuation token">,</SPAN> url<SPAN class="punctuation token">,</SPAN> path<SPAN class="punctuation token">,</SPAN> typeNetworkRequest<SPAN class="punctuation token">.</SPAN>callback<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">else</SPAN> <SPAN class="punctuation token">{</SPAN> loadStatus <SPAN class="operator token">=</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
So if I am correct I think this is the line that I need to modify
var path = [fileFolder.path, "~"+itemName].join("/");
Perfect thanks....will give that a whirl....appreciated.
There is no setting the in the Quick Report template to change the default storage location of the mmpk file, but this can be change in the code in QuickReport/controls/MmpkManager.qml ~80
I am using the Quick Report template....maybe there is a setting in the QuickReportApp.qml file?
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.