WP7 BackgroundAudioPlayer plays only while attached to debugger - debugging

I'm working on music app for WP7. It downloads music from our servers in form of little segments (each track is devided into 128k encrypted pieces). I'm using AudioPlayerAgent and AudioStreamingAgent to download, decrypt and play music.
Everything works fine, while I start application from visual studio via F5. When I start app from menu on emulator or device, everything works fine except of music is not playing. BackgroundAudioPlayer never starts. Doesn't metter if I try debug or release build, or if I try it on emulator or real device(Nokia Lumia 710 and HTC HD7 Pro).
I think that I have everything correctly setted up in AppManifest:
<Capabilities>
<Capability Name="ID_CAP_GAMERSERVICES" />
<Capability Name="ID_CAP_IDENTITY_DEVICE" />
<Capability Name="ID_CAP_IDENTITY_USER" />
<Capability Name="ID_CAP_LOCATION" />
<Capability Name="ID_CAP_MEDIALIB" />
<Capability Name="ID_CAP_MICROPHONE" />
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_PHONEDIALER" />
<Capability Name="ID_CAP_PUSH_NOTIFICATION" />
<Capability Name="ID_CAP_SENSORS" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="Panorama.xaml" />
<ExtendedTask Name="BackgroundTask">
<BackgroundServiceAgent Specifier="AudioPlayerAgent" Name="AudioPlaybackAgent1" Source="AudioPlaybackAgent1" Type="AudioPlaybackAgent1.AudioPlayer" />
<BackgroundServiceAgent Specifier="AudioStreamingAgent" Name="AudioStreamAgent1" Source="AudioStreamAgent1" Type="AudioStreamAgent1.AudioTrackStreamer" />
</ExtendedTask>
</Tasks>
After some research I found that I can enable hidden console for emulator to see debug log. I tried to track what happens when I start app from emulator menu. In point where BackgroundAudioPlayer should start playing track following message appers:
PID:0E8500C6 TID:0EEE006A Sentinels are Disabled for all processes.PID:0E8500C6 TID:0EC500DE Exception 'Raised Exception' (0xc0008005): Thread-Id=0ec500de(pth=c0654930), Proc-Id=0e8500c6(pprc=c05f3160) 'HeadlessHost.exe', VM-active=0e8500c6(pprc=c05f3160) 'HeadlessHost.exe'
PID:0E8500C6 TID:0EC500DE PC=42a629f7(mscoree3_7.dll+0x000529f7) RA=42ac3ae5(mscoree3_7.dll+0x000b3ae5) SP=0634f6b8, BVA=00000000
I also tried to test app in MarketplaceTestKit if any unsupported Api is causing it, but app passed all test fine.
So my question is: does anybody know, while app is playing only when attached to debugger?
Thank You,
Jan.

You should only have one type of background audio agent in your app.
Based on your description of how you're getting the tracks, it seems that using the streaming agent will be more appropriate.
If you're playing each segment directly (treating it as a separate track) and there isn't an issue with gaps as you switch between segments (tracks) then you could use the playback agent.
Having multiple background audio agents specified can cause your app to crash. Note. You'll have to edit the WMAppManifest file directly to remove the one you don't want.

Related

Android Wear watch face companion configuration activity not linked

I've updated my Android Wear watch face according to the official API, and overall it's gone pretty well. One thing I'm stuck on, however, is launching the companion (handheld) config activity from within the Android Wear app. I just can't get the "gear" icon to appear on my watch face preview image in the AW app - AW isn't recognizing my config link.
Just to be clear, every other part of this app is working OK; the app runs fine on both devices, the watch face works, Data API works, auto-install works. It's just this link to my settings activity that's borked.
Here's the relevant portion of my handheld app's manifest:
<activity
android:name=".google.WatchfaceSettingsActivity"
android:label="#string/pref_wear_wf_title" >
<intent-filter>
<action android:name="com.mypackage.google.CONFIG_WEAR_WATCHFACE" />
<category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
And here's the matching bit of my wearable app's manifest:
<service
android:name=".wear.WatchFaceService"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER" >
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.mypackage.google.CONFIG_WEAR_WATCHFACE" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category
android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
As I understand it, the crucial part is the com.mypackage.google.CONFIG_WEAR_WATCHFACE string, which appears in both manifests. Everything looks OK to me - is there just something stupid I'm missing?
Almost correct, but it looks like the intent filter category for your handheld Activity is set incorrectly as WEARABLE_CONFIGURATION. It should be:
com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION
More info: http://developer.android.com/training/wearables/watch-faces/configuration.html

how to launch windows phone app via browser url

I am new to windows phone app development. Is it possible to open windows phone app via browser url. If possible, please someone help me.
How to implement my very own URI scheme on Android
please visit the above url;
but its possible in the android
<activity
android:name="TabHost"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="myschema" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
below code is working in windows 8 desktop IE Browser
but its not working in the windows phone
<Applications>
<Application Id="SDKSample.App" Executable="$targetnametoken$.exe" EntryPoint="SDKSample.App">
<Extensions>
<Extension Category="windows.protocol">
<Protocol Name="alsdkcs" m2:DesiredView="useLess"/>
</Extension>
<Extension Category="windows.fileTypeAssociation">
<FileTypeAssociation Name=".alsdkcs" m2:DesiredView="useLess">
<SupportedFileTypes>
<FileType>.alsdkcs</FileType>
</SupportedFileTypes>
</FileTypeAssociation>
</Extension>
</Extensions>
<m3:VisualElements DisplayName="Launcher API C# sample" Description="AssociationLaunching C# sample" ForegroundText="light" BackgroundColor="#00b2f0" Square150x150Logo="Assets\squaretile-sdk.png" Square44x44Logo="Assets\smallTile-Phone-sdk.png">
<m3:DefaultTile ShortName="Launcher API C#" DefaultSize="square150x150Logo" Wide310x150Logo="Assets\tile-sdk.png" Square71x71Logo="Assets\mediumtile-sdk.png">
<m3:ShowNameOnTiles>
<m3:ShowOn Tile="square150x150Logo"/>
<m3:ShowOn Tile="wide310x150Logo"/>
</m3:ShowNameOnTiles>
</m3:DefaultTile>
<m3:SplashScreen Image="Assets\splash-Phone-sdk.png" BackgroundColor="#00b2f0"/>
<m3:ApplicationView MinWidth="width320"/>
</m3:VisualElements>
</Application>
Hell... I got the answer. It's working if I call via javascript
<input id="btnwindowsphone" type="button" class="button" name="" value="open windows phone" onclick="javascript:loadwindowsphone();" /><br /><br />
function loadwindowsphone() {
window.location = 'alsdkcs://hd';
}
You can do the same for Windows phone - registering custom URI scheme that will open your app.
Here are some resources for you:
Auto-launching apps using file and URI associations for Windows Phone 8
URI schemes for launching built-in apps for Windows Phone 8
This documentation article works for Windows Phone 8.1 / Windows Phone 10 Mobile:
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh779670.aspx
If you're running into issues not being able to open the URI scheme you registered it's most likely because you're trying to open it using Internet Explorer / Edge. This will not work.
Instead send yourself an email containing the link or put it down into OneNote - just an external place, that actually links into the browser.
Otherwise IE / Edge will treat your scheme as http://myscheme/ instead of myscheme://.

Ads in windows phone

I have published 3 apps in windows phone marketplace.I added ad control to each app and added client id and app id from pubcenter to apps.But ads are not displayed in any of my apps.What could be the problem?
Did it work in your emulator/developer device? I had the same problem, where nothing appeared. Did you enable the following Capabilities:
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
<Capability Name="ID_CAP_IDENTITY_USER" />
<Capability Name="ID_CAP_MEDIALIB_PHOTO" />
<Capability Name="ID_CAP_PHONEDIALER" />
All of them are needed for advertising.

Get "An unexpected error has occurred." when using MediaLibrary.GetPictureFromToken 500+ pictures on phone

i get "An unexpected error has occurred." when using MediaLibrary.GetPictureFromToken(String token). Has any one the same Problem?
Device: HTC Mozart
I was getting this as well, and after some digging, it's because I didn't have the ID_CAP_MEDIALIB turned on in the App Caps.
<Capabilities>
<Capability Name="ID_CAP_LOCATION"/>
<Capability Name="ID_CAP_NETWORKING"/>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
<Capability Name="ID_CAP_GAMERSERVICES"/>
<Capability Name="ID_CAP_MEDIALIB"/>
</Capabilities>
Welcome to the wonderful and exciting world of "Media" programming on WP7.
You cannot access the WP7 Media library while debugging a WP7 device that is connected to Zune. The exception you described is the exception you'd normally see in this situation. You have 2 options:
Close Zune, and start WPConnect instead. That should allow you to debug from Visual Studio without Zune. And it even supported Media apps. the file is located on my machine # C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Tools\WPConnect\WPConnect.exe
Consider using the unlocked emulator ROM for debugging the Pictures hub in the emulator.
Could it be that your phone has run out of storage space if you've been generating a lot of data/pics/etc?
You can check this in Settings | About.

Menu (Command) using J2ME Polish and Generic MPDP2 build

I am using J2ME Polish for my application. The app itself is fairly simple but we are using polish for it's nice UI. I would like to have a popup menu (Command) that is similar to the picture attached. I am able to get this kind of UI for device specific builds, such as Nokia 6212 Classic but not for Generic MIDP2 builds.
I believe everything is being rendered on J2ME Canvas and I don't see any technical reason why this cannot be rendered for a generic device. Could anyone out there let me know if this is not possible by design?
Any pointers on how to get this working is appreciated. Thanks.
I have found the solution after going through the document 'Complete guide to J2ME Polish, The solution for professional wireless Java development", which I highly recommend for anyone making use of this library.
J2ME Polish supports "menu" mode when the device has a feature "hasCommandKeyEvents". This is available by default when you are developing for a device that is already present in the device database (devices.xml and other related xml files). But if you are developing for a custom device, this feature needs to be set for the device definition. For example, I am developing for ALL Nokia S40, S60 devices. Add the following entry in the file custom-devices.xml.
<device supportsPolishGui="true">
<identifier>Nokia/Midp2CCLDC11</identifier>
<groups> Series60,Series40</groups>
<capability name="ScreenSize" value="240x320"/>
<capability name="FullCanvasSize" value="240x320"/>
<capability name="CanvasSize" value="240x320"/>
<capability name="BitsPerPixel" value="16"/>
<capability name="JavaPackage" value="mmapi1.1, wmapi, wmapi2.0,m3g, pdaapi, nfc" />
<capability name="JavaPlatform" value="MIDP/2.0" />
<capability name="JavaConfiguration" value="CLDC/1.1" />
<capability name="JavaProtocol" value="http, https, ssl, tls, tcp, udp" />
<capability name="HeapSize" value="10 MB" />
</device>
Build for this device Nokia/Midp2CLDC11. The UI would now show the menu.

Resources