I recently started doing some development in the Windows Phone 8 OS I'm pretty new on this. I was doing some searching about the fact to create an app who play any audio for some specific events/actions.
I was reading the Windows Phone API reference from Windows Phone Dev Center http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff626516%28v=vs.105%29.aspx#BKMK_Win32andCOMAPIforWindowsPhone
But it seems a little confusing to me at first glance and I have the doubt of which one of the following should I use to accomplish my task.
The .Net API for Windows Phone
Win 32 and COM API
... or the Windows Phone Runtime API
Any help would be very appreciate
It really depends what you're trying to do. If you're writing a native application or are interested in cross-compatability with Windows 8 then XAudio2 or the WinRT APIs are definitely the way to go. If you just want to play some infrequent sounds (say, when you pop up a warning dialog) from within a XAML app then I have seen a number of approaches, teh easiest of which is probably just having a MediaElement in your XAML that you use to play the audio.
Related
This may seem an odd question , but I'm just wondering if the process of finalising a WP8 app is different to a WP7 app.
In WP7 when I am ready to publish an app I just go into the Debug/Bin folder upload the XAP top Dev Center. However, when I do this with WP8 apps they never serve ads. Also the XAP is always called something like AppName_AnyCPU_Debug.xap compared to just AppName.xap in WP7 apps (using VS2010).
I know with Windows 8 you do something different, but is it the same in WP8?
Help is appreciated.
Yes, its same in Windows phone 8.
But dont forget to check the project for store requirements.
Here is the link for more info on Store test kit
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394032%28v=vs.105%29.aspx
I am not sure about windows phone 7 but in windows phone 8 *_AnyCPU_Debug.xap means that xap is targeted for any CPU architecture(x86 or ARM) currently all windows phone CPU are ARM based. and secondly _Debug means that the xap is build as debug and that is not a good idea to publish the as the xap will contain unnecessary debug symbols and effect app performance. alwasy use build mode release when every you are publishing your app.
In WP8 I had to get the list of songs from "MusicLibrary" class and play it through the "MediaPlayer" class. It was simple enough. But both of these are gone in 8.1. Actually pretty much everything is gone. Even simple things like page navigation syntax has changed completely (and I don't see any logical reason behind doing that)
Can someone tell me how I can get the list of songs in the user's phone in WP8.1? And how to play them in the background? I can't find any documentation on 8.1 on the net at the moment. After a lot of googling I only managed to find one example which showed how to play a file from isolated storage. Please help..
I think you are targeting windows phone 8.1 (Windows Run time version) If you target windows phone 8.1 Silverlight almost everything is same as windows phone 8. Windows phone 8.1 winRt is targeted for code re-usability on window phone and windows store app. So if you are targeting both platforms then try to Use Universal Apps.
Edit
For Player use <MediaElement... and for accessing Music library use below code.
var folder = Windows.Storage.KnownFolders.MusicLibrary;
var files = await folder.GetFilesAsync();
Hope this helps.
So, our Windows Phone developer left recently, and I primarily do Android development.
We had a question from a client about the possibility of installing our Windows Phone 8 app on a Surface Tablet. Namely, is it possible to do? As it stands, our WP8 app was not written with tablets in mind, so my question is:
Is there anything I need to do to the WP8 app to get it to install on a tablet, (should it work as-is (like Android apps do), is there some sort of flag I have to enable and then rebuild, etc.?)
As #AMR mentions, the biggest challenge will be the UI; however, depending on the device functionality being used, the "backend" may or may not be a challenge as well.
There is great guidance on the Windows Phone Dev Center about practices and techniques for building for both platforms, so depending on when the phone app was built and your former developer's awareness of the overlapping platforms, you could be in great shape or just so-so shape.
Additionally, the following resources may be of help in mapping from what you have already coded in Windows Phone 8 to what you'd do in Windows 8:
XAML controls comparison between Windows Phone 8 and Windows 8
(much will be relevant to Windows Phone 7 too)
Windows Phone 8 and Windows 8 platform comparison (shows common
APIs, storage, networking, etc.)
Lastly, the Windows Phone Runtime API documentation gives a listing
of APIs only on Phone 8 vs. APIs adopted from Windows 8.
Okay well first off yes, there will be a few things that change but nothing to serious.
HOPFULLY you have a good MVVM model. If this is the case then you should be able to just copy and paste 99.999% of your backend code right into your tablet app. There are a few things that are different but its just namespace stuff. Nothing too serious.
The Major change is going to be your UI layout and UI controls. Depending on what libs you are using you will probably have a lot of conflicts.
Your best bet is to just copy and paste your backend code in and then creating a new UI. I have tried to merge phone UIs in the paste into the tablet and its rediculous at times. I found it takes less time to just recreate it.
If you need any help you can hit me up at www.AnthonyRussell.info Maybe I can help with your transfer. Just make sure to leave your contact info.
What would be the best approach to simulate a user tapping on a touchscreen of a Windows Phone 8 device?
One approach I could imagine is to use native code to call the Win32 API functions which control the mouse events. This would assume that touchscreen events are more or less the same as mouse events, and that these API functions are accessible. Does anyone know if this is the case on WP8?
Another approach would be to have something like the Android ADB for the Windows Phone. On Android, one can use ADB to control the device from the PC and also simulate touch screen events (e.g. via Monkeyrunner). I haven't found any information if there is a tool like ADB for Windows Phone 8.
The purpose of finding a solution for this is the integration of Windows Phone 8 devices in an automated testing process.
I found out that there is a DLL file named InputInjection.dll in the System32 folder of the Windows Phone 8 (at least in the simulator image I mounted).
This library contains the following functions:
ApiInjectInitialize
ApiInjectTouchEvent
ApiInjectButtonEvent
ApiInjectEnableExclusive
ApiInjectUninitialize
Doing some research, I found out that there are official ways to simulate touch input for Windows 8 development:
http://social.technet.microsoft.com/wiki/contents/articles/6460.simulating-touch-input-in-windows-8-preview-versions-using-touch-injection-api-en-us.aspx
http://msdn.microsoft.com/library/windows/desktop/hh802896(v=vs.85).aspx
However, the functions used for Windows 8 development are not available on Windows Phone 8. But the functions are named similarly to the ones I found in InputInjection.dll:
InitializeTouchInjection similar to ApiInjectInitialize
InjectTouchInput similar to ApiInjectTouchEvent
(...)
I wasn't able to find any documentation on InputInjection.dll and its functions. These functions also don't appear in the header files of the SDK. Maybe Microsoft uses these functions internally for their own tests during Windows Phone development.
The question is: Is it possible to access this library and call these functions somehow? This would be similar to using "Private APIs" on iOS, I guess. I tried several ways to achieve this with a Windows Phone 8 app using native C++ code, but I had no luck so far (the basic reason is that the apps run sandboxed on Windows Phone). Is there any way to get a binary running on Windows Phone (maybe via a debug bridge or something)?
You can access all those API's From Win32 Service/ Kernel Driver. Include the header file to your source code and Library of injection method it will work
I'm completely new to Windows Phone and the Windows galaxy in general as far as programming goes. For a project of a phone app that has to run on a windows phone, I started exploring the resources and I have some questions.
One of the problems I encountered is that things change very quickly. For example, answers to this question say that browsers in Windows Phone will most likely not support HTML5. However, there are many online tutorials (for instance here) introducing ASP.NET MVC 4 and how it is appropriate for mobile apps.
I would personally like to go the "HTML5+javascript" way instead of learning how to develop with Silverlight, which apparently has been discontinued by Microsoft. However, my first concern is evidently to be able to create an application that works!
So with that in mind, my questions are the following:
My impression is that HTML5+JS is being introduced in replacement of Silverlight and will be more used in the future. Is that correct?
Knowing that I have to build an app which should be able to play videos and audio, record audio, and connect to a library to do some speech processing in the background, should I use Silverlight or can I try using ASP.NET MVC 4? (From what I gather, Silverlight would be better than XNA)
Are there limitations to using HTML5+JS as compared to Silverlight or the other way around?
Can you package a web app (i.e. using HTML5+JS) to be used locally on the phone if there is no access to a distant server?
Any specific pointers or answers on these specific issues will be more than welcome! :)
Currently, Windows Phone 7.1 does not support full HTML5+JS as a replacement for Silverlight. In Windows 8 (NOT the next version of windows phone, but the next version of Microsoft's desktop OS), HTML5+JS is presented as an alternative to using XAML and C# (it's a little confusing because on Windows 8, "metro" apps do not run Silverlight, but they still operate using XAML and C#). But that's neither here nor there... To summarily answer your question(s): In the phone's browser, there is very limited HTML5 capability.
From what you've described, you definitely want to use Silverlight for your Windows Phone app. The answer to that part of your question has never changed, Silverlight from the beginning of WP7 would be your best option. XNA is exclusively designed for gaming development.
To answer all of your questions, point by point:
My impression is that HTML5+JS is being introduced in replacement of
Silverlight and will be more used in the future. Is that correct?
This has not been confirmed (as of this post), but speculation is that this will be the case in some future release of the OS (no word on when that may be). But no, this is not currently an option, and there is no promise from Microsoft that it ever will be.
Knowing that I have to build an app which should be able to play
videos and audio, record audio, and connect to a library to do some
speech processing in the background, should I use Silverlight or can I
try using ASP.NET MVC 4? (From what I gather, Silverlight would be
better than XNA)
Silverlight. Silverlight. Silverlight. :) ASP.NET + MVC will not work. XNA is intended to be used for building games. Attempting to build more standard user interfaces using it would give you a migraine to say the least, and would not look anywhere near good.
Are there limitations to using HTML5+JS as compared to Silverlight or the other way around?
and
Can you package a web app (i.e. using HTML5+JS) to be used locally on the phone if there is > no access to a distant server?
As answered above, there is no way to do this on the phone.
As for pointers on all of this. I strongly encourage you to simply google (or bing if you're into that kind of thing) "getting started with windows phone" or "windows phone tutorials". Best source I could point you to is the Windows Phone Developer website. It's got some great tutorials that don't assume you know lots about windows phone. Best to get this material from Microsoft. It'll be more reliable, more well written, and ultimatly more useful. I've been writing Windows Phone apps since before the phone was released, and I still use it for learning the basics of something new. Great place.