Flex AS3 Iphone - How to Open Native Maps Application? - ios

I have a bunch of buttons that opens the default map application and puts something in the users system clipboard. It works fine on Android tablets, but the Iphone does nothing when the button is clicked. Here is the code:
case "MapYummyYummy":
System.setClipboard( "1665 Stelton Rd Piscataway Nj 08901" )
_callURL = "geo: 40.4978922, -74.4488224";
var targetURL:URLRequest = new URLRequest(_callURL);
navigateToURL(targetURL);
break;
Does anyone know the equivalent for this that will work on Iphone devices? thanks!

Have you tried this setData method? (I have no experience with this one, but looks like a viable alternative).
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html#setData()
iOS launch maps via URL reference:
http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html
Querying for a location:
http://maps.apple.com/?q=cupertino
setting a start and end for directions:
http://maps.apple.com/?daddr=San+Francisco,+CA&saddr=cupertino
Hope it works for ya (looked up not tested).

Related

Detecting ARKit compatible device from user agent

We would like to enable a feature that allows a model to be viewed using a deep link to our ARKit app from a web page.
Has anyone discovered a way to discover if a device is ARKit compatible using the user agent string or any other browser-based mechanism?
Thanks!
Apple seems to use the following code to show/hide the "Visit this page on iOS 12 to try AR Quick Look" on https://developer.apple.com/arkit/gallery/
(function () {
var isRelAR = false;
var a = document.createElement('a');
if (a.relList.supports('ar')) {
isRelAR = true;
}
document.documentElement.classList.add(isRelAR ? 'relar' : 'no-relar');
})();
The interesting part of course being
var isRelAR = false;
var a = document.createElement('a');
if (a.relList.supports('ar')) {
isRelAR = true;
}
Make your actions accordingly based on the value of isRelAR.
Safari doesn’t expose any of the required hardware information for that.
If you already have a companion iOS app for your website, another option might be to still provide some non-AR experience for your content, so that the website has something to link to in all cases.
For example, AR furniture catalogs seem to be a thing now. But if the device isn’t ARKit capable, you could still provide a 3D model of each furniture piece linked from your website, letting the user spin it around and zoom in on it with touch gestures instead of placing it in AR.

App used to work with AIR 3.2, doesn't work with AIR 3.5

I'm getting this error when I press a button in a flash/air app that used to work in the AIR 3.2 SDK - now upgraded to the AIR 3.5 SDK. Any help much appreciated.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at seed_template_fla::MainTimeline/frame7()[seed_template_fla.MainTimeline::frame7:31]
at flash.display::MovieClip/gotoAndPlay()
at seed_template_fla::MainTimeline/gotoPage() [seed_template_fla.MainTimeline::frame1:20]
at seed_template_fla::MainTimeline/gotoRepro() [seed_template_fla.MainTimeline::frame1:12]
I'm creating an app for iPhone using Flash CS6 on Mac and exporting using the Air 3.5 SDK. I also have the AIR 3.5 runtime installed.
The app is very simple at the moment. It basically moves from frame to frame when you press a button using the gotoAndPlay(frameNr) function. There are some hexes on the frames that update an array of numbers when clicked. They are also toggled visible/not visible.
This used to work perfectly using the AIR 3.2 SDK, but I recently downloaded the AIR 3.5 SDK from adobe and added it through flash (Help>Manage Air SDK) and set it as the build target in File>Publish Settings>Target.
When I switch back to AIR 3.2 SDK, the app works perfectly again.
Also, when I upload the app to my iPhone 4S running IOS 5.1 using AIR 3.5 SDK, I just see a black screen with 5 loading dots flashing. This also works fine with AIR 3.2 SDK.
This is the code for frame 7
The last line is line 31.
stop();
techtitle.text = "Select Trait";
techdesc.text = "Spend points to change core stats and other special abilities";
points.visible = false;
techpoints.visible=false;
pointsbalance.text = myPoints.toString();
btn_tech.visible = false;
curTechSelected = null;
trace("set hexes invisible");
for (var j:int = 0; j <= 67; j++) {
if (hexStatusb[j] == 1) {
this["btn_hex_"+j+"b"].visible = false;
}
}
function onBtnHex37bClick(event:MouseEvent):void
{
techtitle.text = "tech1";
techdesc.text = "tech1 description"
techpoints.text = "-2";
points.visible = true;
techpoints.visible=true;
btn_tech.visible = true;
curTechSelected = btn_hex_37b;
curTechSelectedNr = 37;
curTechPoints = 2;
}
trace(this["btn_hex_37b"]);
btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);
OK - so, after trying out lots of things, I figured out why this is happening.
Solution: get rid of all TFL text objects when running AIR 3.5 SDK
It seems that the TFL Text library wasn't being loaded properly at runtime. Something crucial that I neglected to mention was that I was getting this warning message (similar here http://forums.adobe.com/thread/825637)
Content will not stream... The runtime shared libraries being preloaded are textLayout_1.0.0.05... TFLText
and this warning message in the output
Warning: Ignoring 'secure' attribute in policy file from http://fpdownload.adobe.com/pub/swz/crossdomain.xml. The 'secure' attribute is only permitted in HTTPS and socket policy files.
Simply removing all TFLText objects and changing them to classic text makes the app work fine again.
#csomakk Great news. I have found the answer. You can publish in 3.5 and 3.6 and have your TLF Text too. I posted a write-up on my blog that shows exactly how to do it.
To get started: the error message states that something is null.. it means, that the program doesn't know, where to look for it. It can happen, when you didn't create the object (btn_hex_37b = new MovieClip()); or you haven't even created a variable for it.
on the given line (btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);) only btn_hex_37b can be null, because onBtnHex37bClick exists, and if it wouldn't, the program wouldn't compile.
The reason it came up when switching to AIR 3.5 is probably that it calls some creation functions in different order. Go to the line where you define the btn_hex_37b variable. Search for that functions calling.. Make sure, that btn_hex_37b is created before going to frame7.
Also, if its not a vital, to have onBtn_hex_37bClick, you can do the following:
if(btn_hex_37b){
btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);
}
the if will check if btn_hex_37b is not null.
On the else method, you can give a timeouted method(but that is ugly), or give the eventlistener right after the creation of the object.
Hope this helped.
For Flash CS6, copy this swc:
/Applications/Adobe Flash CS6/Common/Configuration/ActionScript 3.0/libs/flash.swc
Into my Flash Builder project using these steps:
http://interactivesection.files.wordpress.com/2009/06/include_fl_packages_in_flex_builder-1.jpg
and then use this link
http://curtismorley.com/2013/03/05/app-used-to-work-with-air-3-2-or-3-4-doesnt-work-with-air-3-5-or-3-6/#comment-241102

How does phoneGap (Cordova) work internally, iOS specific

I have started developing html applications for mutliple platforms. I recently heard about Cordova 2.0(PhoneGap) and ever since I have been curious to know how the bridge works.
After lot of code walking, i saw that the Exec.js is the code where call from JS -> Native happens
execXhr = execXhr || new XMLHttpRequest();
// Changeing this to a GET will make the XHR reach the URIProtocol on 4.2.
// For some reason it still doesn't work though...
execXhr.open('HEAD', "file:///!gap_exec", true);
execXhr.setRequestHeader('vc', cordova.iOSVCAddr);
if (shouldBundleCommandJson()) {
execXhr.setRequestHeader('cmds', nativecomm());
}
execXhr.send(null);
} else {
execIframe = execIframe || createExecIframe();
execIframe.src = "gap://ready";
But want to understand how that works, what is the concept here, what does file:///!gap_exec or gap://ready do? and how does the call propgate to the lower layers (native code layers)
thanks a bunch in advance.
The trick is easy:
There is a webview. This displays your app. The webview will handle all navigation events.
If the browser navigates to:
file:///!gap_exec
or
gap://
the webview will cancel the navigation. Everything behind these strings is re-used as an identifier, to get the concrete plugin/plugin-method and parameter:
pseudo-url example:
gap://echoplugin/echothistext?Hello World
This will cause phonegap to look for an echoplugin and call the echothistext method to send the text "Hello World" to the (native) plugin.
update
The way back from native to javascript is (or may be) loading a javascript: url into the webview.
The concrete implementation is a little bit more complex, because the javascript has to send a callback-id to native code. There could be more than one native call are running at the same time. But in fact this is no magic at all. Just a number to get the correct JSON to the right javascript-callback.
There are different ways to communicate between the platform and javascript. For Android there are three or four different bridges.
I am trying to figure this out in more detail, too. Basically there are 2 Methods on the iOS side that can help ...
- webView:shouldStartLoadWithRequest:navigationType: and
- stringByEvaluatingJavaScriptFromString:script
From the sources it seems cordova sends a "READY" message using webView:shouldStartLoadWithRequest:... and then picks up results with the second message, but I am not sure.
Cordova Sources iOSExec
There is much to learn there.

How to find that current Blackberry device support Hindi(or Gujarathi) or not?

Hi blackberry developers,
I am implemented one application targeted to OS6 and above.
Here i am loading url which is contain some Indian (Gujarathi) language into the browserField.
Here My problem is that text displaying some devices correctly but not all.
it is showing text properly in Bold 9780 OS6, But Tourch 9800 OS7 is not showing properly.It is showing only Rectangular Boxes.
So i need to know that is my devise support gujarathi language are not first.
I am using some code to get list of available languages
Locale []loc1=Locale.getAvailableInputLocales();
for(int i=0;i<loc1.length;i++)
{
System.out.println("=====1: "+loc1[i].getLanguage()+"======"+loc1[i].getDisplayLanguage());
RichTextField rh1=new RichTextField("ISO: "+loc1[i].getLanguage()+"==name: "+loc1[i].getDisplayLanguage(),Field.FOCUSABLE);
add(rh1);
}
String []loc2=Locale.getISOLanguages();
for(int i=0;i<loc2.length;i++)
{
System.out.println("=====2: "+loc2[i]);
RichTextField rh2=new RichTextField("ISO: "+loc2[i],Field.FOCUSABLE);
add(rh2);
}
in both cases it is displaying as attachment.
And strange thing is that in both array's i am not finding any language named as "Gujarathi" or "gu(ISO code)". But perfectly displaying data on my 9780 but 9800 not showing.
So Here i want to know what is the reason behind this ?
1) If suppose my devise is supporting "Gujarathi" Language then why it is not showing it's name in Locale.getISOLanguages(); or Locale.getAvailableInputLocales();?
2)How can we know that current device can support required language language?
I also tried using desktop-manager--->Applications------->available languages even here also i am not finding anything related to indian languages
I need to give answer to Client that what is the reason behind this ?
I goggled for 12Hrs. But no use So i decided that you are my only hope?
Try Checking Localization Demo
http://docs.blackberry.com/en/developers/deliverables/33805/Localization_sample_app_files_1791764_11.jsp

Blackberry facebook integration error

I have integrated the facebook in my app using http://sourceforge.net/projects/facebook-bb-sdk, it work fine in stimulator but when view in device it show me the
http://m.facebook.com/login.php?app_id=0000000000[0.0] 61&cancel=http%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html%3Ferror_reason%3Duser_denied%[0.0] 26error%3Daccess_denied%26error_description%3DThe%2Buse[0.0] r%2Bdenied%2Byour%2Brequest.&fbconnect=1&next=https%3A%2F%2Fm.facebook.com%2Fdialog%2Fpermissions.re[0.0] quest%3F_path%3Dpermissions.request%26app_id%3D175269295861061%26redirect_uri%3Dhttp%253A%252F%252Fw[0.0] ww.facebook.com%252Fconnect%252Flogin_success.html%26di[0.0] splay%3Dwap%26response_type%3Dtoken%26fbconnect%3D1%26perms%3Duser_about_me%252Cuser_activities%252C[0.0] user_birthday%252Cuser_education_history%252Cuser_events%252Cuser_groups%252Cuser_hometown%252Cuser_[0.0] interests%252Cuser_likes%252Cuser_location%252Cuser_not[0.0] es%252Cuser_online_presence%252Cuser_photo_video_tags%252Cuser_photos%252Cuser_relationships%252Cuse[0.0] r_relationship_details%252Cuser_religion_politics%252Cuser_status%252Cuser_videos%252Cuser_website%2[0.0] 52Cuser_work_history%252Cemail%252Cread_friendlists%252[0.0] Cread_insights%252Cread_mailbox%252Cread_requests%252Cread_stream%252Cxmpp_login%252Cads_management%[0.0] 252Cuser_checkins%252Cfriends_about_me%252Cfriends_activities%252Cfriends_birthday%252Cfriends_educa[0.0] tion_history%252Cfriends_events%252Cfriends_groups%252C[0.0] friends_hometown%252Cfriends_interests%252Cfriends_likes%252Cfriends_location%252Cfriends_notes%252C[0.0] friends_online_presence%252Cfriends_photo_video_tags%252Cfriends_photos%252Cfriends_relationships%25[0.0] 2Cfriends_relationship_details%252Cfriends_religion_pol[0.0] itics%252Cfriends_status%252Cfriends_videos%252Cfriends_website%252Cfriends_work_history%252Cmanage_[0.0] friendlists%252Cfriends_checkins%252Cpublish_stream%252Ccreate_event%252Crsvp_event%252Coffline_acce[0.0] ss%252Cpublish_checkins%252Cmanage_pages%252Coffline_ac[0.0] cess%26from_login%3D1&rcount=1&_rdr
I have change the app id in url.
just show me the text in white background.Please let me know if anything else requires.
Thank you
It was issue from network side,i have check with other wi-fi and it was working.
Thank you.

Resources