switch the cameratype in Windows Phone7 - windows-phone-7

all, as we know, the CameraType property indicates the location of the camera on the device. But when I try to swich the cameratype from Primary to FrontFacing by using the following code, it does not work. After reviewing the MSDN document, I found it was a protected set method. And obviously I have no access permition. Is there any way to do that?
Could any one help me?
Thanks in advance!
camera.CameraType = CameraType.FrontFacing;

It seems like you can't force the camera to a different mode after you initialize it.
Use the constructor of the implementation.
For ex: Constructor of PhotoCamera class
I assume you're trying to create a custom camera app ? or something similar ?
If you just want to capture a picture, use Camera Capture Task instead of this. Otherwise your app will fail certification.
If photo capture is not a core feature of your application, consider using the Camera Capture Task to capture photos instead of using the camera APIs directly. Memory allocated for the Camera Capture Task does not count toward total application memory use. This helps minimize your application’s memory use, which is particularly important when your application runs on a 256-MB device. For more information, see Developing for 256-MB Devices and How to: Use the Camera Capture Task for Windows Phone.

Related

Add to publisher next methods changeVideoTrack/changeAudioTrack

Sometimes needs to change camera and cycleVideo is not good for this purposes because we cant control deviceId and its video/audio track
We need methods like (especially when it is different devices)
publisher.changeVideoTrack(myVideoTrack);
publisher.changeAudioTrack(myAudioTrack);
You can implement it (based on cycleVideo) very fast in opentok SDK.
At this moment to change stream track we are need to destroy publisher and create new one - its bad solution
Adam here from the OpenTok team. Thank you for your feedback. You can currently change the audio track using the setAudioSource() method of the publisher. We also have a setVideoSource() on our roadmap to add in the future.

Xamarin iOS External Accessory: check whether hands free device (car) is available

I want my app to detect the Hands-Free built in the car. I don't need to communicate with the device, I just need to check if it is available.
Ex: I want to send a notification when an Hands-Free is available on the vehicle.
I got this working with CoreBluetooth but it only works with BT4/BLE. Do I need to use EAAccessoryManager for old Bluetooth devices (version 2.0)? How can I implement this? I did try the code below but does not work:
var _accessoryList = EAAccessoryManager.SharedAccessoryManager.ConnectedAccessories;
foreach (EAAccessory acc in _accessoryList)
{
// devices
}
The list _accessoryList is always empty.
The info.plist contains the background mode External accessory communication and the key UISupportedExternalAccessoryProtocols which I am not sure what should be the value to put in.
Any help? what am I missing? Thanks

How to add google map and map pins using Xamarin cross platform

I'm new to the Xamarin. I need to create a small application to make use phone resources and google map.
For resources access like, call, sms, flash on/off you can make use these
phoneDialer.MakePhoneCall(phoneNo);
smsMessenger.SendSms(phoneNo, smsMessage);
CrossLamp.Current.TurnOn();
CrossLamp.Current.TurnOff();
I think this will help you get some idea. You can also create a utility class where you can create a function and make use these for all platform and you can call the corresponding functions whenever it is necessary.

Google Cast: Get Currently Playing Song from Audio Device

I am trying to use the Google Cast SDK to write a tiny app.
This app should be able to show which (Google casted) song my audio system is currently playing.
This should include info about the track's title, length, artist, album etc.
Using the iOS classes I have managed to connect to the correct GCKDevice via the GCKDiscoveryManager. But how do I get the data about the track which is currently playing?
I would prefer an answer for the iOS classes, but I would also greatly appreciate any hint towards achieving the same with the Chromecast browser extension.
Addon:
On the Cast Developers +-Group I was pointed to this link, thanks Leon! I see that I should register a GCKRemoteMediaClientListener which I could do if I had a GCKRemoteMediaClientobject. The only way to get that seems to be via a GCKSession. I can create such a session from scratch but then the property remoteMediaClient is nil. Or I can ask the GCKCastContext.sharedInstance().sessionManager to start a session for me. But if I do that, the device stops playback immediately.
So I am still a bit lost about how to achieve my initial goal.
Any help please?
After some more help by Leon from the Cast Developer Group, I have figured this one out. The key information is the id of the app which is running on my audio device. I figured that out by the deprecated 2.0 API which is why I will not add this detail.
So assume you have that key, you can initialize yiur cast context by
let options = GCKCastOptions.init(receiverApplicationID: applicationID)
GCKCastContext.setSharedInstanceWith(options)
Next thing is to find your device. This was not too hard (the only thong I figured out by myself :o) and the GCKCastContext.sharedInstance().discoveryManageris your friend here.
If you now start a session via the GCKCastContext.sharedInstance().sessionManager it will not stop the playback. Totally logical in hindsight, makes me wonder which app I started before with that random app id I used...
With the session started you can cast that session to a cast session and add a session listener.
if let session = sessionManager.currentSession as? GCKCastSession {
session.add(self)
}
And when that session notifies its activeness as noted in
func castSession(_ castSession: GCKCastSession, didReceive activeInputStatus: GCKActiveInputStatus)
you can now find the long lost remoteMediaClient and register for his precious events
if let client = castSession.remoteMediaClient {
client.add(self)
}
And this will end the long journey by calling your delegate method
func remoteMediaClient(_ client: GCKRemoteMediaClient, didUpdate mediaMetadata: GCKMediaMetadata)
And if you are as I lucky as I was that media data is quite incomplete.
Mine just contained the title and the release date and nothing else.
Thanks Deezer!
But maybe I can use some id or other obtained in the whole process to get the missing data from the Deezer server? Time will tell.
In the meantime I hope this help somebody with more luck.

Emulate Motion API on an emulator

I am developing an app which uses a accelerometer + compass sensor and I would like to run it the emulator. The problem with that is that Mango only allow to emulate Acceleromter, but it doesn't to emulate Motion.
I thought of creating a Mock object using the same base class as Motion does (SensorBase - abstract class), however it's constructor is internal and I can't inherit from it :/
Any ideas how to overcome it?
I have solved it by wrapping a Motion service inside an object which exposes the functionality of the motion service using ReactiveExtensions.
So in the end I would simple have to emulate a sequence of numbers.

Resources