Windows Phone - PhotoChooserTask not showing - windows-phone-7.1

I'm having a problem with this PhotoChooserTask because it's not showing up when I deploy it on my device. It's working though in Emulator. I made a very simple code but am not sure why it's not showing.
// inside the button
PhotoChooserTask selectphoto = new PhotoChooserTask();
selectphoto.ShowCamera = true;
selectphoto.Completed += new EventHandler<PhotoResult>(selectphoto_Completed);
selectphoto.Show();
// -------------
void selectphoto_Completed(object sender, PhotoResult e)
{
if (e.TaskResult == TaskResult.OK)
{
// blah blah blha
}
}
any idea?
I'm using Windows Phone 7 Mango (7.1)
------ update ----
I took the e.TaskResult and I always get "Cancel". Is there something wrong?
I got an idea... maybe because Zune is running :P
--- update --
solved. Zune is running :P

It's now always good to test your app on actual device if you're working or implementing Camera or PhotoChooserTask and you are connected in Zune.
So before deploying your app onto your actual device with media capabilities, make sure to disconnect your phone to Zune.

Related

Testing React Native with Appium: how to get past "Permit drawing over other apps"?

In my initial proof of concept for testing a React Native mobile app using Appium, I noticed that when I load the APK to start my test, I am presented with an Android prompt to "Permit drawing over other apps" as I am creating my AndroidDriver driver. If I move the slider manually, then click the back button, all is good -- the app loads fully, and my test proceeds. However, I don't see how to do this with automation using my Appium script because it looks like the driver instantiation will not complete until the slider is moved.
Most people don't see this in Appium testing as it appears to be specific to React Native in dev mode, as seen here...
Here's my code where I've put in conditional code to click the slider, but I never get there because it waits at the "driver = ..." line:
AndroidDriver driver = null;
#Before
public void setUp() throws Exception {
// < defining capabilities (emulator6p) up here...>
// initialize driver object
try {
driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), emulator6p);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
}
#Test
public void test1() throws Exception {
By BY_slider_permitDrawing = By.id("android:id/switchWidget");
boolean present = (driver.findElements(BY_slider_permitDrawing).size() == 1);
if (present) {
driver.findElement(BY_slider_permitDrawing).click();
driver.navigate().back();
}
WebElement button_begin = driver.findElementByAccessibilityId("button-lets-begin");
button_begin.click();
}
I definitely hear plenty of people say that Appium is a viable solution for React Native testing, and really need to get over this hump.
Thanks in advance for any suggestions!
jph
p.s. In case it wasn't really clear, the test does NOT hang at the "driver = " line if I am not loading the APK from scratch, but I will need to do that for CI testing in the future.
Setting right capabilities helped me to run Appium tests in Debug mode on Android:
{
...
"appWaitPackage": "com.android.settings, com.yourPackage",
"appWaitActivity": "com.android.settings.Settings$AppDrawOverlaySettingsActivity, com.yourPackage.MainActivity",
}
Replace yourPackage with your real package name used in Android app. Some docs here: https://appium.io/docs/en/writing-running-appium/caps/#android-only

ZXing barcode scanner in Xamarin Forms on iOS doesn't read barcodes

I'm working on a Xamarin Forms PCL project targeting Android and iOS that needs some basic barcode scanning functionality.
I got things up and running with the forms version of the ZXing.Net.Mobile package following this tutorial and referencing this guide and it works great on Android. However, on iOS the camera comes up but the OnScanResult event is never fired.
I've tested it on several iOS devices running several different versions (anywhere from 8.0 - 10.3) and fiddled with everything I can think of, referencing their sample projects as well. ZXing.Net.Mobile and ZXing.Net.Mobile.Forms nuget packages were installed in all projects.
Here's my scanner code, triggered from a button press on my main page:
var scanPage = new ZXingScannerPage();
scanPage.OnScanResult += (result) =>
{
scanPage.IsScanning = false;
Device.BeginInvokeOnMainThread(async () =>
{
await Navigation.PopAsync();
await DisplayAlert("Scanned Barcode", result.Text, "OK");
});
};
await Navigation.PushAsync(scanPage);
and AppDelegate.cs:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
global::ZXing.Net.Mobile.Forms.iOS.Platform.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
After two days of fighting with this, I feel like I'm at my wit's end. Has anyone else encountered similar problems? Thanks for any guidance!
Edit 1
Here's the device log output (Message column only) when clicking the button to trigger the above code. No log items are added while the camera is open and pointed at various barcodes. I don't see anything suspicious here, but maybe someone else does?
PERF: Alloc AVCaptureVideoPreviewLayer took 14.14 ms.
AppleH4CamIn::power_on_hardware
AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 0
StartScanning
AppleH4CamIn::setPowerStateGated: 1
ZXingScannerView.Setup() took 0.167 ms.
ASL Sender Statistics
AppleH4CamIn::ISP_FlushInactiveDARTMappings: 0x00000000
AppleH4CamIn::ISP_SelectBestMIPIFrequencyIndex_gated - channel: 0, index: 0
Edit 2
I ran the sample Xamarin Forms PCL from the github repo and am having the same problems on iOS with the camera opening fine, but no barcode ever read. Therefore I'm thinking the problem must be with my Visual Studio and/or Xamarin setup. I'm running Visual Studio 2015 Community on the stable Xamarin channel.
add this on ios
protected override void OnAppearing()
{
base.OnAppearing();
qrcode.IsScanning = true;
}`enter code here`
protected override void OnDisappearing()
{
qrcode.IsScanning = false;
base.OnDisappearing();
}
Try using this:
scanPage.IsAnalyzing = true;
IsAnalyzing is different from IsScanning.
I faced the same the issue like you. But after using IsAnalyzing = true; It is fixed.
I finally got it working with this project as a starting point. It's just a basic barcode scanning implementation using ZXing, but for whatever reason I could finally read barcodes on iOS.
It's probably a version-related problem, but I couldn't narrow it down.
Edit
I posted this same question in the Xamarin Forums: https://forums.xamarin.com/discussion/comment/272209#Comment_272209
It seems the answer was downgrading to ZXing version 2.1.47. I haven't done any work with the library for a few months so I haven't tested new versions.

Unity Facebook SDK - iOS 8 Login Issues

I've had Facebook integrated in my Unity app, and I've been using it on my iPhone 5 with iOS 7 with no problem. But the problem comes when I try it on my friend's iPhone 6 running iOS 8. When I make a call to FB.Login() it switches to the Facebook app, as it normally should, but when it comes back to my app, Facebook opens the Webview for the Facebook login page with the error "You must log in to continue."
The app registers that Facebook.IsLoggedIn is true, and the app continues as if it's logged in, but the Webview is still there and I have to close it to get back to my app.
The only real clue I have about what could be wrong is that the LoginCallback is being called twice in iOS 8 but not in iOS 7.
Any relevant code is below, but it seems like the issue is coming from within the Facebook SDK itself.
public static readonly string FB_SCOPE = "email,public_profile,user_friends";
FB.Login(FB_SCOPE,FBLoginResult);
void FBLoginResult(FBResult result) {
Debug.Log (result.Text);
}
Anyone have any idea, or experience anything similar?
I had the exact same problem. Turns out the FB.Login code was fired twice.
I suggest you write a log near the FB.Login and make sure you don't see it twice.
It seems that this is due to a bug in Unity3D specific to iOS 8. See here for details : http://fogbugz.unity3d.com/default.asp?692236_po26b9sb1uqlag7p
Here is a workaround to fix the problem in NGUI. Go to UICamera.cs and add the following line of code in the function public void ProcessTouches ()
MouseOrTouch touch = null;
if (input.phase == TouchPhase.Ended && !mTouches.TryGetValue(currentTouchID, out touch))
return;
just after this :
for (int i = 0; i < Input.touchCount; ++i)
{
Touch input = Input.GetTouch(i);
currentTouchID = allowMultiTouch ? input.fingerId : 1;

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

Capture pictues in blackberry application using VideoControl only works on emulator and not device

This is only some of the code because other parts of it are spread out but on the simulator for blackberry curve this adds a VideoControl to the manager and shows up fine with another button that actually captures the picture. However, when I run this on an actual Blackberry curve (version 6 I think) it doesn't display this on the screen.
try
{
_p = javax.microedition.media.Manager.createPlayer("capture://video?encoding=jpeg&width=1024&height=768");
_p.realize();
_videoControl = (VideoControl) _p.getControl("VideoControl");
if (_videoControl != null)
{
videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
// _videoControl.setDisplayFullScreen(true);
_videoControl.setVisible(true);
// EnhancedFocusControl efc = (EnhancedFocusControl)p.getControl("net.rim.device.api.amms.control.camera.EnhancedFocusControl");
// efc.startAutoFocus();
_p.start();
if(videoField != null)
{
add(videoField);
}
}
}
catch(Exception e)
{
Dialog.alert(e.toString());
}
In my experience the way of image taking you use has appeared very unreliable (it worked fine only on a limited number of devices), so I stopped using it. Use native Camera app instead - it works fine on all devices.
A lot of the time when things work on the emulator but not device it's permissions related, have you checked ApplicationPermissionsManager?
Word of warning, from OS4.5 to 6 a lot of stuff has been deprecated so be sure you check you have the right permissions for the models you are working with.
e.g. ApplicationPermissions.PERMISSION_SCREEN_CAPTURE was deprecated in 4.6 I think.

Resources