Launch an App by hardware key press in windows phone10 - windows-10-mobile

How to launch the windows app using hardware key when the phone in locked state. need hardware key event to trigger action in windows 10 or 8.1 windows store app .

Instead
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed; you need use var systemNavigationManager = Windows.UI.Core.SystemNavigationManager.GetForCurrentView(); which contains BackRequested event
Also you can add extension library and use API for Windows Phone 8.1 Store App
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;
But when device was locked your application go to suspend mode and you cannot handle events

Related

UWP windows 10 store and windows 10 mobile store

I am building an application targeting windows 10 desktop and mobile both some functionality like back button functionality is different for each device mobile device use hardware back button while desktop use title bar back button option
do i have to make 2 different projects for each of device ?
No, you can have just one. Originally the back button handling on phone was done separately using the Mobile Extension SDK, but in later builds before the final release of Windows 10 this back button handling was refactored to be universal for all device families, although the back button is displayed on a different place in each.
Basically the only thing you need is to wire up the event globally:
Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested +=
App_BackRequested;
To learn more, see the official MSDN documentation.

Creating Crash Log for Windows Phone 8.1

I am working on Windows phone 8.1 app, I need to log all the exception and some information to a file and also console at the same time.
1.How can I do that?
2.Is there any third party for that?
I need to send that log file when ever the app crashes.
You could use HockeyApp. It stores crash report and sends it to the server next time user start the application. It completely free (Microsoft has acquired HockeyApp) and provides SDK for Window Phone / Windows Store platform.
http://hockeyapp.net/features/crashreports/

How to simulate an incoming call within the windows phone simulator?

I need to test how my app reacts when an incoming call interrupts execution. How can I do this in the simulator?
Go to Properties of your App(right click on solution Explorer), Select Debug tab and there you will find a checkbox(Tombstone upon deactivation while debugging), check that. After checking it whenever the apps gets deactivated , it will get in to tombstone state while debugging.
I think that Scenario is not possible to Test in Emulator. You can make call from your app in emulator but Receiving can be tested in only Device. for more Reference you can refer this Question Windows Phone 7 emulator : Can I simulate a phone call.
To test for making a call from your app, you can find Reference here How to use the phone call task for Windows Phone 8

Cordova localstorage not persisting

I am developing an Hybrid Mobile app using Windows Phone 7 sdk and phonegap. Using Cordova local storage I am storing value. The stored value does not persist If I close the app and launch again in windows phone emulator. Anybody used local storage or alternative persistant storage in windows phone shares idea would be great.
window.localStorage.test = "Some test data";
console.log(window.localStorage.test) //It prints result but does not persist
I believe the correct syntax is:
window.localStorage.setItem("test", "Some test data");
console.log(window.localStorage.getItem("test"));
Assigning properties appears to work simply because javascript allows you to attach new properties to objects.
Original Answer Are you closing the emulator between executions? The emulator clears its user state when you close it.

how to pin an application to start in windows phone emulator?

I am new to windows phone. I have developed a sample windows phone app. Its running fine in emulator . My problem is that I cant find any option to pin the application to start in windows phone emulator?
You can pin an application by viewing it in the application list (scroll to the right) and then clicking and holding and selecting the Pin To Start menu option that appears.

Resources