Permission is ALLOWED but not WRITE Android AngularJS with Ionic - android

Hello everybody I have a problem a long time and decided to post , on some devices I can not write anything , this happens especially in mobile phone android(4.1-4.4) that does not have sdcard.
Some phones usually work ( especially with android 5.0 ) with or without SDCARD .
My routine is:
CHECKS(READ) localStorage ->
IF OK : AUTH AUTOMATIC -> UPDATE LOCALSTORAGE -> GO HOME PAGE.
ELSE : USERS INFORMATION LOGIN AND PASSWORD -> AUTH -> SAVE LOCALSTORAGE -> GO HOME PAGE.
ALREADY TRIED USE : SQLITE AND FILE.
but in some phones especially with android ( 4.1 - 4.4 and without SDCARD ) he finds no content in LocalStorage , so every time the User open the app it needs to inform login and password.
OBS:
1. I checked the AndroidManifest and i HAVE WRITE_EXTERNAL_STORAGE and READ.
when installed on an emulator android 4.1 without SDCARD , I encounter the following error in CMD " rm failed for -f , Read only file system"
My permissions
whitelist
camera
media-capture
device
statusbar
file
file-transfer
imagepicker
media
network-information
file-opener2
sqlite-storage
ms-adal
x-toast
socialsharing
Thank you in advance

Related

Open here map url from mobile

I'm developing hybrid application and want to access to HERE map url from any device (android / ios / windows phone / web)
I tried to follow this answer : Create URL to here.com
But It's not working in all cases.
In my case, i tried this url : https://www.here.com/directions/drive/start:48.85,2.35/end:52.51,13.38
Android without Here map app installed : open m.here.com -> ok
Android with Here map installed : open m.here.com but do not find app installed -> failed
iOS without Here map app installed : open m.here.com -> ok
iOS with Here map app installed : open m.here.com and ask if we want to use app installed, but if i click yes, app say me 'cannot find itinerary' -> failed
Windows Phone 10 without Here map app installed : ask me to install Here map app, if i say yes, redirect to store with no result (failed), if i say no, error page -> failed
Windows Phone 10 with Here map app installed : open app but say me 'cannot find itinerary' -> failed
Web : ok
I have more errors than success cases, so i can't use this kind of url.
Is there a different kind of URL that I can use to open m.here.com if there is no installed application, and launch application if it is installed?
(or open m.here.com in all cases at least)
The deeplinking developer guide has been recently made public, you could use that.
https://github.com/heremaps/map-linkbuilder-app
http://heremaps.github.io/map-linkbuilder-app/
So, try creating share urls
(You'll get something like this: https://share.here.com/r/52.51607,13.37699,Berlin%2C%20Germany/51.05364,13.74082,Dresden%2C%20Saxony%2C%20Germany?m=d&t=normal)

How to delete data in tempDirectory on app restart/shutdown - Appcelerator Titanium

Part of my app functionalities is allowing user to multi select photos from gallery and then upload them. Before uploading, user is free to add/delete their photos.
What I'm doing is I create and store these temporary image files in Titanium.Filesystem.tempDirectory, with an intention that these will be deleted eventually on app restart or shutdown.
Though, when I use Finder to track these files, they're still there and do not get deleted after I close and reopen the app/reboot ios simulator.
So do I have to explicitly delete these files? Does the actual ios device behave any differently?
Thank you
Simply the codes where these img files get created:
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.tempDirectory, fileName);
if (f.write(imageBlob) === false) {
console.log("Image writing failed");
}
You can just leave the files there. On a device they will be cleaned up when the device needs space.

how do I open a newly written file from application storage directory in as3 / flex mobile?

Im working on an app (flex 4.12 sdk, using flashbuilder 4.5, creating an app for ios and android, testing on an android htc one primarily)... and am using the camera to capture a file... Im then saving that image to the application storage directory, and I want to open the image in the default web browser or trigger a native dialog (android users) to choose the web browser of their choice... how it opens isnt really important right now -- Im mainly trying to just 'access' it with the device and 'load' it outside my air app...
heres the code I have:
var fs2 : FileStream = new FileStream();
fs2.addEventListener(Event.CLOSE, fileCompleteHandler);
var targetFile : File = File.applicationStorageDirectory.resolvePath("test.jpg");
fs2.openAsync(targetFile, FileMode.WRITE);
fs2.writeBytes(myBMDByteArray,0,myBMDByteArray.length);
fs2.close();
and for the event listener that detects the close of the newly created file:
function fileCompleteHandler(e:Event):void {
trace('File saved.');
trace('exists? ' + targetFile.exists);
trace('the url: ' + targetFile.url);
trace('path: ' + targetFile.nativePath);
navigateToURL(new URLRequest(targetFile.url));
}
I get the following info back from this listener
File saved.
exists? true
the url: app-storage:/test.jpg
path: /data/data/air.com.xxxxx.apptesting.debug/com.xxxxx.apptesting.debug/Local Store/test.jpg
... and problem is that navigateToURL cant access the location where the file is stored (the protocol shows in browser as file:///data/data/air.com/xxx... )
how can I use navigateToURL to get access to this newly created file in the web browser or whatever native application the device associates with the file (its a .JPG file)? I also have had success in adding the newly created image to the camera roll but couldnt figure out how to then open that newly saved image in the native camera roll or whatever app the device chooses or presents to the user for the .jpg format.
I can show the user the image INSIDE my app by referencing the bitmap data fine, I just want to give the user access to the physical file that Im creating on their device.
I even have had success in posting (via urlLoader) the bitmap data as base64 encoding and then creating a file on the server side and loading that url but the encoding and trip to and from the server to give the user the image adds a lot of overhead and it takes a little too long and I'd like to avoid that elongated process.
Thanks for any help anyone can provide - let me know if I need to be more specific in any of this.
Solved the issue... I was able to store / write my file in the documentsDirectory using:
var targetFile : File = File.documentsDirectory.resolvePath('test.jpg');
and then
navigateToURL(new URLRequest(targetFile.url));
And this works fine now. Hopefully it helps someone else! Seems that the storage directory SHOULD work but up until now I've only written to and read files stored there... maybe to open the files one HAS to copy it to a 'safe' location in the filesystem (i.e. sd card?)... will move on to test in ios Now - hope all works well in that OS. Thanks all who chimed in on this.
My first hunch is that you need to specify the proper user-permissions in your application descriptor so you can use the openWith functionality with content from your application.
Remember that you need to specify this for IOS and Android specifically.
On your application.xml you need this permissions set inside android > manifestAdditions > manifest:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
With this permissions you can save files to applicationStorageDirectory:
const FILE_LOADER:URLLoader = new URLLoader();
FILE_LOADER.addEventListener(Event.COMPLETE, onTempFileComplete);
FILE_LOADER.dataFormat = URLLoaderDataFormat.BINARY;
FILE_LOADER.load(new URLRequest(BASE_URL + filePath));
The applicationStorageDirectory can only be accessed by the application it belongs too when using Android or iOS. navigateToURL() hands over your request to the default browser, which cannot access said directory.
documentsDirectory is a public directory in Android, but not in iOS. So it cannot be used for both platforms. Unfortunately none of the pre-compiled file paths File has point to a public directory in iOS. You can find a table explaining all the pre-compiled paths here

Search through open apps contents ADB Android

Is it possible to search through a currently open developer's app (ie not signed) via adb?
I can currently use adb shell to sniff around inside the phone. But I have no idea if I can look at the current app that is open in the phone.
[edit]
Just for some background information, in my app I check to see if a file exists or not, this way I can tell if the app is live or just in development. As when the app is built for live different files are added.
So I use this:
$.ajax({
url:'file:///assets/www/cordova.js',
type:'HEAD',
error: function(el)
{
c(el.readyState);
},
success: function()
{
c('//file exists');
}
});
This will check if the file exists or not, however recently the files used have changed and I can no longer find them.

Android - Worklight Hybrid application fails to connect to server in the emulator

I created a worklight application. I tried running that application on android emulator and i am getting the following error.
[http://localhost:8080/apps/services/api/MyFirstApp/android/query] Host is not responsive.
Try to manually access the URL through the android emulator browser to verify connectivity
So i tried to enter the same url in the emulator browser, i got the following text:
/*-secure-
{"WL-Authentication-Failure": {"wl_remoteDisableRealm":{"reason":"Login Failed}}} */
Can someone help me with this?
I am using Android OS version: 4.2.2, API level: 17
I haven't changed any application settings myself..
I am trying to go to a basic login page with the url "https://jazz.net/jazz/auth/j_security_check"
This is my adapter XML:
<wl:adapter xmlns:wl="worklight.com/integration"; xmlns:http="worklight.com/integration/http"; xmlns:xsi="w3.org/2001/XMLSchema-instance"; name="RQMAdapter">
<displayName>RQMAdapter</displayName>
<description>HTTP type Worklight Adapter for jazz server</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>https</protocol>
<domain>jazz.net</domain>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="loginToRQM" />
</wl:adapter>
This is my scenario:
I have a requirement where I need to read information about the projects from jazz.net for a user. They are all available on the jazz server within an XML file. I need to process it to a mobile device to make it available on hand held device... So, now I am told that i will have to download some of the files from the server, so i need to have file IO on my app. I learned that we need to write this part using a Cordova plug-in in Worklight.
please let me know what else is needed for the solution... thank you
Make sure to place the actual IP address of your server machine:
Change the value for worklightServerRootURL in the file
application-descriptor.xml (located at: yourProject\apps\yourApp)
Build and deploy
Right-click on the generated Android project >> Run As >> Run application
If you are using using Worklight 5.0.5, make sure to upgrade to 5.0.6, where a fix is available when only API Level 17 is installed.
As for going to that URL, you need to explain where exactly you're trying to go to it from, and how... you need to be more descriptive. It sounds to me like you haven't gone through the Getting Started material. Please do.
I had the same problem.
I have solved it by using the real IP address of the server in the WL app instead of using localhost:
When the emulator is running your app, press the Menu button.
Select to change your server URL
Remove "localhost" and use the IP address.
Accept and try again.
This fixed my problem.

Categories

Resources