Phone Data Access in android, iphone using Flex Builder - apache-flex

Is it possible to access phone data like (Contact,Message) in android,Iphone using Flash Builder Mobile Development app .... If It's Possible using Adobe air so tell me ..
thanks

If the underlying operating system exposes that data, you can access it using a Native Extension. You may have to write your own Native Extension to do that, though.

You can call these API's -
Accelerometer
GPS
Camera
Microphone
To store data-
Sql Lite Datebases
OS Interactions-
Text Message
Email
Call
Example-
protected function sendMessage(event:MouseEvent):void {
var message:String = "";
message +="sms:";
message+ = sendTo.text;
navigateToURL ( new URLRequest (message));
}
This should open your messaging app. However the data you to want to read is mostly going to be protected. You can write a Native Extension though and plug Flex into it.

Related

Where to Get Encryption Key for Realm App in Swift

I have a Swift app that uses the Realm Object Server running remotely on a Linux server. Everything is working, including real-time sync.
Occasionally I want to inspect the contents of a local Realm file used by the iOS Simulator so I can do some debugging. When I browse here:
~/.../CoreSimulator/.../Documents/realm-object-server/<unique id>/
...and I try to open this file: realm%3A%2F%2F104%2E236%2E129%2E235%3A9080%2F%7E%2Fmyapp.realm
I get prompted with: Please enter a valid encryption key for this Realm file.
Where do I get this encryption key? I tried using the admin token from the server, but that doesn't appear to be working.
Also, can I turn off encryption everywhere? Or is it mandatory for any app using the Realm Object Server?
It is not possible to open the local version of a synced Realm file using the Browser (or anything else, for that matter). This is due to differing history types internally (but I won't go into that now). In order to inspect the contents of the Realm file, you have to open it using the previously defined syncURL. The browser will then download the file and show you the contents.
A few links on this topic:
https://github.com/realm/RealmTasks/issues/327
https://github.com/realm/realm-core/issues/2276
You may use old version of Realm Browser, please update it and check the result again.
Use Realm Studio instead which worked for me.
Here can download the file
byte[] key = new byte[64];
new SecureRandom().nextBytes(key);
String encryptionKey = byteArrayToHexString(key);
//encryptionKey is what you want byteArrayToHexString see
Log.d("test", "encryptionKey:"+encryptionKey);
byteArrayToHexString() method you can see:How to convert a byte array to a hex string in Java?

Is there an equivalent of DeviceNetworkInformation.NetworkAvailabilityChanged event on UWP?

I'm converting my Windows Phone 8 Silverlight to UWP and I can't find an equivalent to DeviceNetworkInformation.NetworkAvailabilityChanged event in UWP
I know that on UWP we have to use ConnectionProfile to get info about user's connection (Wifi, 3G, etc...)
ConnectionProfile InternetConnectionProfile = NetworkInformation.GetInternetConnectionProfile();
But it seems that there are no events to check if the Internet becomes unavailable in ConnectionProfile object.
Does anyone know how to do this in UWP?
Thanks
There might be no equivalent of DeviceNetworkInformation.NetworkAvailabilityChanged Event in UWP APIs by now. But we can achieve this by combining NetworkInformation.NetworkStatusChanged event with ConnectionProfile.GetNetworkConnectivityLevel method.
Ref Remarks in ConnectionProfile.GetNetworkConnectivityLevel:
The recommended process for determining the network connectivity level is to register a handler for the NetworkStatusChanged event on the NetworkInformation class. When a notification is received of a network status change, obtain the new connectivity level by calling the GetNetworkConnectivityLevel method on the profile returned by the GetInternetConnectionProfile method. The returned network connectivity level can then be stored for later use when needed. This also ensures that the correct ConnectionProfile is checked.
Following is a simple sample:
NetworkInformation.NetworkStatusChanged += (s) =>
{
var profile = NetworkInformation.GetInternetConnectionProfile();
var isInternetConnected = profile != null && profile.GetNetworkConnectivityLevel() == NetworkConnectivityLevel.InternetAccess;
};
Also you can encapsulate this into an event like in this blog: How to react to network availability changes in Windows Store apps.

How to detect, in AIR application, if user has denied access to camera/microphone on ios 8 permissions?

I am having an AIR application which uses camera/microphone. Need to know if the user has selected "deny access" on IOS 8 ipad, then how the app will be able to detect?
The camera or the microphone are native functions so in AIR in order to access them you need native extensions. If you have a native extension already you should have a method like isSupported that returns true or false if the user allowed access to mic or camera. If you don't have a method like above you need to add one and use native code to check that user give permission for each platform in your case for iOS.
You can definitely access the microphone without an ANE via flash.media.Microphone.
I'm guessing getMicrophone() would return null if denied:
mic = Microphone.getMicrophone();
if (mic==null) {
// No microphone found or access denied
}
And this is very old (2009) but here's an example AIR project using the microphone you could reference.

custom notification sound on GCM air extension

I'm building a GCM extension which an AS3 developer can set the location of an mp3 file on sdcard and when the GCM notification runs, that custom sound plays. all good, all fine.
but when I close my air app and send a notification from server, android default sound will be played. and that happens because when the air app is closed, its context is null and the extension does not have access to the parameters set by the app, so it plays the default sound.
I know I can create resources inside the .ane and use them as a custom sound but I don't want to do that. I want to leave the AS3 developer with the freedom to chose the location of the sound file himself.
any ideas?
Thanks,
Hadi
it's a shameless self promotion but I think it's good to tell people who are looking for this to checkout the finished extension here: http://myappsnippet.com/gcm/
the air extension supports custom custom sounds and icons!
You're probably going to have to add some settings to the application that get stored somewhere within the native Android scope and access them from within your GCM notification receiver.
Have a look at SharedPreferences
http://developer.android.com/reference/android/content/SharedPreferences.html
For example:
//
// Save a shared preference
SharedPreferences sharedPreferences = context.getActivity().getSharedPreferences( "YOUR_PREFERENCES_NAME", Activity.MODE_PRIVATE );
Editor preferencesEditor = sharedPreferences.edit();
preferencesEditor.putString( "customNotificationSound", soundLocation );
preferencesEditor.commit();
Then in your receiver:
SharedPreferences sharedPreferences = context.getActivity().getSharedPreferences( "YOUR_PREFERENCES_NAME", Activity.MODE_PRIVATE );
String soundLocation = sharedPreferences.getBoolean( "customNotificationSound", false );

How to Store User Preferences in an Adobe Flex/AIR Application

What's the standard way of storing user preferences in a Flex application for AIR? I need to store simple parameters like lists of recently opened files, window positions and sizes etc.
my favorite way to do it is to combine a VO with LSO (local shared object). If you have a LOT of settings, this doesn't work too well. The advantage is that you get a strongly typed settings object which is therfore bindable and has code introspection and completion.
The cool thing is it's only about 5 lines of code to manage an LSO. In addition, it's also pretty easy to manage a local encrypted store if you want to store any sensitive data.
registerClassAlias("SettingsVO",SettingsVO); //This lets us store a typed object in LSO
var settings:SettingsVO;
var settingsSO = SharedObject.getLocal("settings");
//Check to make sure settings exist... if not, create a new settings object
if( settingsSO.size && settingsSO.data && settingsSO.data.settings){
settings = settingsSO.data.settings as SettingsVO;
}else{
settings = new SettingsVO();
}
Now if you want to save settings you simply do
settings.someSetting = "newValue";
settingsSO.data.settings = settings;
settingsSO.flush();
And this solution works on BOTH AIR and Flex in any browser. Newer browsers will delete this data when clearing cookies, so beware of that.
I think the most flexible way is to use a local SQLite database. It gives you unlimited, structured storage and encryption if needed. See Peter Elst's introduction if you want to get more info.
There is no "Standard" way, but there are a lot of approaches, all which boil down to storing the user's preferences, then loading them up at runtime based on some uesr credentials, then changing the app based on those preferences.
You may store them in a server side database, such as SQL Server or MySQL; then have flex call a service which queries the database and returns the data.
You may store them as Shared Objects, which are the Flash version of browser cookies. (I believe they work on AIR applications too). This can get cumbersome with lots of data.
You may store them in an XML document and throw them on the server. Conceptually this is not much different than storing them in a server side database; but could get very tedious if you have a lot of users.
You could also store them, in an AIR app, locally using a SQLite database. SQLite is an embedded database used in Adobe AIR.
I don't bother with any of the fancy stuff. Just store it in an xml file in the application directory. Done.
Filestream does throw an error if you try to store it using File.applicationDirectory. I just trick the program...
var trickFile:File = File.applicationDirectory;
var file:File = new File(trickFile.nativePath + mySettings.xml);
Air falls for it every time.

Resources