I try to check if application is installed on the device. In BlackBerry I can do it with
CodeModuleManager.getModuleHandle("applicationName");
How can I do it on the Nokia device?
You can try the following code:
String platform = System.getProperty("microedition.platform");
boolean isNokia = false;
if (platform != null) {
platform = platform.toLowerCase();
isNokia = platform.indexOf("nokia") >= 0;
}
http://www.developer.nokia.com/Community/Wiki/System_property_microedition.platform_values_for_Symbian_devices
Related
I have a Xamarin.Mac application in Sandbox mode that need to allow a user to choose any file from there system since my application is a Viewer.
I use NSOpenPanel and NSSavePanel but my application crash without any crash logs when running the code.
I have added com.apple.security.files.user-selected.read-write to the Entitlements file etc.
Code:
var panel = NSOpenPanel.OpenPanel;
panel.FloatingPanel = true;
panel.CanChooseDirectories = true;
panel.CanChooseFiles = true;
int i = panel.RunModal ();
if (i == 1 && panel.Urls != null) {
foreach (NSUrl url in panel.Urls) {
}
}
Seam to be a bug in Xamarin.Mac:
https://bugzilla.xamarin.com/show_bug.cgi?id=24466
I can't seem to find the property for the MediaCapture class that allows me to detect the front camera and switch to it if available. Here is my current setup of the device, it all works as expected on Windows (front cam) and Phone (rear cam). None of the Microsoft samples show the front camera being used in Universal or WP 8.1 (WinRT/Jupiter).
mediaCaptureManager = new MediaCapture();
await mediaCaptureManager.InitializeAsync();
if (mediaCaptureManager.MediaCaptureSettings.VideoDeviceId != "" && mediaCaptureManager.MediaCaptureSettings.AudioDeviceId != "")
{
StartStopRecordingButton.IsEnabled = true;
TakePhotoButton.IsEnabled = true;
ShowStatusMessage("device initialized successfully!");
mediaCaptureManager.VideoDeviceController.PrimaryUse = CaptureUse.Video;
mediaCaptureManager.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
mediaCaptureManager.SetRecordRotation(VideoRotation.Clockwise90Degrees);
mediaCaptureManager.RecordLimitationExceeded += RecordLimitationExceeded;
mediaCaptureManager.Failed += Failed;
}
There is a sample on the Microsoft github page that is relevant, although they target Windows 10. Still, the APIs should work on 8/8.1.
UniversalCameraSample: This one does capture photos, and supports portrait and landscape orientations. Here is the relevant part:
private static async Task<DeviceInformation> FindCameraDeviceByPanelAsync(Windows.Devices.Enumeration.Panel desiredPanel)
{
// Get available devices for capturing pictures
var allVideoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
// Get the desired camera by panel
DeviceInformation desiredDevice = allVideoDevices.FirstOrDefault(x => x.EnclosureLocation != null && x.EnclosureLocation.Panel == desiredPanel);
// If there is no device mounted on the desired panel, return the first device found
return desiredDevice ?? allVideoDevices.FirstOrDefault();
}
And you can use it like so:
// Attempt to get the front camera if one is available, but use any camera device if not
var cameraDevice = await FindCameraDeviceByPanelAsync(Windows.Devices.Enumeration.Panel.Front);
if (cameraDevice == null)
{
Debug.WriteLine("No camera device found!");
return;
}
// Create MediaCapture and its settings
_mediaCapture = new MediaCapture();
var settings = new MediaCaptureInitializationSettings { VideoDeviceId = cameraDevice.Id };
// Initialize MediaCapture
try
{
await _mediaCapture.InitializeAsync(settings);
_isInitialized = true;
}
catch (UnauthorizedAccessException)
{
Debug.WriteLine("The app was denied access to the camera");
}
catch (Exception ex)
{
Debug.WriteLine("Exception when initializing MediaCapture with {0}: {1}", cameraDevice.Id, ex.ToString());
}
Have a closer look at the sample to see how to get all the details. Or, to have a walkthrough, you can watch the camera session from the recent //build/ conference, which includes a little bit of a walkthrough through some camera samples.
Here is how to get the device's available cameras and set the front one for the stream:
mediaCaptureManager = new MediaCapture();
var devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
var deviceInfo = devices[0]; //grab first result
foreach (var device in devices)
{
if (device.Name.ToLowerInvariant().Contains("front"))
{
deviceInfo = frontCamera = device;
hasFrontCamera = true;
}
if (device.Name.ToLowerInvariant().Contains("back"))
{
rearCamera = device;
}
}
var mediaSettings = new MediaCaptureInitializationSettings
{
MediaCategory = MediaCategory.Communications,
StreamingCaptureMode = StreamingCaptureMode.AudioAndVideo,
VideoDeviceId = deviceInfo.Id
};
await mediaCaptureManager.InitializeAsync(mediaSettings);
You'll need to consider rotation because front and rear cameras on different devices have different rotations, but this will initialize your MediaCapture properly
i am developing a sip client using c#.net and in which it has microphone control through which i can mute and unmute the microphone and it works well when i mute and unmute from my application and the issue is when i open my application and mute the mic and same time if i open skype there is issue with mic what i undersatnd is when i mute a mic in my application it is muting all over..can any one guide me how to mute the mic only in my application which does not affects other applications like skype.. etc..here is the code for mute and unmute microphone..
private void MicMuteButton_Click(object sender, EventArgs e)
{
MixerLine micline;
mMixers = new Mixers();
mMixers.Playback.MixerLineChanged += new WaveLib.AudioMixer.Mixer.MixerLineChangeHandler(mMixer_MixerLineChanged);
mMixers.Recording.MixerLineChanged += new WaveLib.AudioMixer.Mixer.MixerLineChangeHandler(mMixer_MixerLineChanged);
micline = mMixers.Recording.UserLines.GetMixerFirstLineByComponentType(MIXERLINE_COMPONENTTYPE.SRC_MICROPHONE);
if ((string)MicMuteButton.Image.Tag == "Disabled")
{
micline.Mute = false;
MicMuteButton.Image = Properties.Resources.MicrophoneEnabled;
MicMuteButton.Image.Tag = "Enabled";
ttu.SetToolTip(MicMuteButton, "Mute");
}
else if ((string)MicMuteButton.Image.Tag == "Enabled")
{
micline.Mute = true;
MicMuteButton.Image = Properties.Resources.MicrophoneDisabled;
MicMuteButton.Image.Tag = "Disabled";
ttu.SetToolTip(MicMuteButton, "Unmute");
}
}
Microsoft wrote a separate framework for lower level graphic and audio called DirectX. Maybe you should try.
I wanted to ask,... What would be the most efficient way to detect the Google Voice Search (app id: com.google.android.voicesearch) installation on Android device?
And is there any way of subsequently installing it without taking user to Play Market and back to application?
You can use the below method
private boolean voiceSearchExists() {
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
final List<ResolveInfo> pkgAppsList = getPackageManager().queryIntentActivities( mainIntent, 0);
boolean packageExists = false;
boolean activityExists = false;
for(PackageInfo r:packs){
String pkg = r.applicationInfo.packageName;
if(pkg != null && pkg.equals("com.google.android.googlequicksearchbox")){
packageExists = true;
break;
}
}
if(packageExists == false)
return false;
for(ResolveInfo r:pkgAppsList){
ActivityInfo info = r.activityInfo;
if(info!=null && info.name!=null && info.name.equals("com.google.android.googlequicksearchbox.VoiceSearchActivity")){
activityExists = true;
break;
}
}
return activityExists;
}
I am creating a program which first checks whether a particular program has been installed or not, if it's installed it continues to execute other code, if it's not installed then it installs the application and then proceeds to execute the other code.
How do i check programatically in VC++ that the application has been installed or not
I got a C# function that does something similar, it looks on both the 32 bit and the 64 bit entries in the registry.I'm assuming you got the right name of the program you are looking for all you need is to match it with key "DisplayName". I doubt you'd have problems making it C++...It would go something like this
string SoftwareKey = #"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
bool found = false;
RegistryKey rk = Registry.LocalMachine.OpenSubKey(SoftwareKey);
foreach (string skName in rk.GetSubKeyNames())
{
RegistryKey sk = rk.OpenSubKey(skName);
if (sk.GetValue("DisplayName") != null &&
sk.GetValue("DisplayName").ToString().Equals("WhateverProgramYouAreLookingFor"))
{
//whatever you need to do with it
found = true;
break;
}
}
if(!found)
{
SoftwareKey = #"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
foreach (string skName in rk.GetSubKeyNames())
{
RegistryKey sk = rk.OpenSubKey(skName);
if (sk.GetValue("DisplayName") != null &&
sk.GetValue("DisplayName").ToString().Equals("WhateverProgramYouAreLookingFor"))
{
//whatever you need to do with it
found = true;
break;
}
}
}