How Check Applcation Status in windows mobiles? - windows-phone-7

I need to know the application status i.e app is in resume state,active or any..programatically in windows mobile 5,6,7 OS phones.
Please help me for that...

Like Chris pointed out, you are not going to be able to check a devices state and have it tell you what it was in. If the device is dormant or not running, your code is not going to run.
However, if you are using Windows Mobile 6, you can elect to receive notifications through the State and Notifications Broker whenever your device goes from one state to another by using the RegistryNotifyApp.
There is a Using the State and Notifications Broker in Native Code example that goes into details.
This tool was not available prior to version 6 of Windows Mobile.
The newer Windows 7 Phone OS is drastically different, and I have no experience with what it is capable of.

Related

Extremely slow socket data throughput on Android 11?

I've seen some posts elsewhere about very slow file access after "upgrading" a device to Android 11. I'm not having that, but I AM having unbelievably slow performance in a small app that uses sockets. It's a client app that uses a socket to send a request to a server (mine) that monitors my solar installation, to get data back about how it has been performing etc. So the socket interaction is in a separate thread from the UI, and uses runOnUIThread to call a function that updates the UI with the received data. The request data is only a few bytes, maybe 20 or so maximum: the data coming back varies from a few hundred bytes to maybe 50000 bytes or thereabouts.
If I run this app on my phone (Android 8.1) it is fine - it takes 1.5 to 2 seconds to send the request, get the data back, and update the UI. Perfectly fine. It's the same on an older tablet running Android 7.1.2 too. But I have just recently acquired a flash (read expensive) new Samsung tablet running Android 11, and its performance is woeful - the same app doing the same operation takes anything up to 30 seconds, or even more. And it is exactly the same app, exactly the same code. Both devices are running on the same network, so the only significant difference seems to be the Android version. It is repeatable ad nauseum, so it isn't momentary network load either. The app is built to target API level 26 - it has to be so it can run on all the devices it needs to. It is not a commercial app, just something for my own use, but I am totally bewildered by this behaviour.
The other thing I have noted with this new tablet is that it is unable to provide a video stream from a surveillance IP camera I have at home. I use the TinyCam Pro app from Google Play for this. It can connect, but it has never yet managed to give me a picture, regardless of how good my connection is. Again, my phone and the older tablet can do this more often than not, and the new tablet would have far more horsepower than either of them. There is some sort of serious bottleneck in there!
Has anyone else seen this type of thing on Android 11? If so, is there anything that can be done about it, that is usable on earlier versions too? Or do we just have to wait for Android 11.1?
EDIT: I've done some more investigation on this, and I think I have now pinned it down to a 4G network bandwidth issue. I said that the tablet and the phone were doing exactly the same thing, but I have since remembered that they do NOT use the same carrier for their mobile connections. So it's not EXACTLY the same thing. I would actually expect the network capacity for the tablet's carrier to be superior to that of the phone's carrier, but that appears not to be the case where I am at the moment. So I think I have to take back my evil thoughts about the tablet, and maybe even Android 11. Interesting how easy it is to be misled, and how hard it can be to genuinely compare apples with apples when there are so many variables and so many links in the chain. I'll be doing some more tests and comparisons when back in the city, where network capacity should be much more alike for the two carriers.
yes its true. While compare to Android 11 and Android 8 there is a lot of changes updated because of security issue.
May be, If your managing some file in mobile storage mnt/sdcard/ here in this path its speed of access or managing a file in this path its restricted and its becomes less. So, if your using this path please change it like below because it will cause youe app to process slow.
solution - Try to use this file access path is Android/data/data/packageName/
I mean if your using this logic to access file - Environment.getExternalStorageDirectory()
instead of above try this - Context.getExternalFilesDir(null)
refer this link https://developer.android.com/about/versions/11/privacy/storage
I hopes it will help you...

Windows phone debugging in device

I am a windows phone app developer. My PC do not have enough graphics to support windows phone emulator. So I am developing application by using the windows phone device (HTC HD7) for debugging and testing from almost 5 months now. Now my device is so hanging and switch-off automatically sometimes. Is it bad for the device to use the developing purpose rather than using emulator ?. Is my device have problem because of the continuous use for developing ?
I think it is not a problem in using device for the developing purpose.
Looks like a fault in the device - I'd send it in for repair. I've certainly not heard of debugging causing issues with devices.
Do check if your internal storage is about getting full. Also if you have minimum RAM config, try not using multiple apps while debugging. Probably this should help.
And nonetheless, you can just visit a technician and get your phone thoroughly checked for issues.

WP7 Webbrowser/Http-request only working when connected to Zune

So I've been toiling over this app trying to figure out this strange behaviour and I'm just getting more and more confused so I thought maybe a more experienced WP7 developer could shed some light on the issue.
I have a (working?) application and I can run it perfectly fine when I'm running it though visual studio and even just when the phone is plugged into the computer but as soon as I disconnect the phone from the computer I can no longer send Httprequests and my webbrowser control no-longer loads pages from my server. Breakdown:
I open the app on the phone while it's plugged into the machine hosting the server and it works perfectly fine, no buggs, all requests go though and webbrowser navigates to pages.
Now if I unplug it from the computer while the app is running natively I lose all ability to make request or navigations (to server hosted pages) in my webbrowser.
Now if I plug it back in all the "Server not found" and "We're having trouble displaying this page" errors go away and my app returns to a usable state.
Is there some kind of permission that must be accepted before the phone can send and receive data from my server that is overridden when the phone is connected to the computer? Has anyone else run into this problem ever or do I just have something wrong with me? I'm am at a loss to find the issue, if you could point me in the right direction that would be great.
EDIT: Ok, so I think it has something to do with it being connected to a computer which is hosting the server. Because when I connect it to my mac (which doesn't have zune or any microsoft stuff) the app responds the same as not being connected (i.e no http or webbrowser)
Just tried running the app again while it was plugged into the server-computer but without Zune running and it did not work (i.e no http or webbrowser). So Zune is DEFINITELY and influencing factor, does anyone know what it's doing that I'm not doing when I unplug it or shut-down Zune? (note: the app is running natively, not through VS)
If I run it on a different computer with Zune running on it, it isn't working either, which I find strange....
Just found this: http://answers.microsoft.com/en-us/zune/forum/zune_install-pc/cannot-connect-to-server-or-dns-error-related-to/b224cffb-3ec0-456a-86f3-f9b931a92367 hopefully it will solve my problems.....we'll see....(Edit: couldn't find an answer here)
Thanks for the help!
Wow! I cannot believe I could have overlooked this. So the network that I thought I was using was different from the one my phone was using. Did you know that the windows phone (at least Lumia 800) automatically uses the internet from whatever computer it's plugged into and NOT the wireless network it's currently connected to if Zune is running on that computer? (well I didn't) On top of that the network that I thought it was connected to (and was using when I disconnected from the server computer) couldn't communicate with the network my server was running. This combination made it really hard to figure out what was going on and I spent WAY to much time trying to figure it out.
Thanks for the suggestions and sorry if I waisted anyones time.

Windows Phone - Application crashes when disconnected from PC

Whenever I disconnect my Windows Phone from PC (connected through USB) and if my application is running, my application hangs for sometime and then application crashes.
Does anyone experienced same behavior? I guess switching for PC connection to Wi-Fi/GPRS is causing the issue.
the windows Phone Requires that you Safely Remove hardware first, after a few times when i started Development on the windows phone i did the same and Ended up getting a new Phone. So plainly put, try to Safely Remove and Make sure it is installing the app to the Device.
Meaning if you Remove the phone, the App is still able to be ran just like a normal downloaded App form the Market place.
if you want more in depth information, i would suggest Reading the WP7 Everything Programming ebook lol
its filled with good information, and Definitely Helped me along my road to Love DEV for WP7.
As gamernb says, if you disconnect the USB from a properly tethered Windows Phone (i.e. connected to Zune, or using the WPConnect utility), the phone's network connection will be reset and your app's connections will be terminated. The phone will then start trying to connect using WiFi or cellular data (if they are on), but this can take quite a while.
You will have to handle this network disconnection in your app - I've found that pulling the USB cable in this way is a good ad-hoc test for WP7 apps: do an action which you know will use the network connection. Then watch if the app crashes, or handles this gracefully.
Actually you aren't guaranteed to always use the PC data connection: if you make sure that the computer has no data connection (i.e. pull the Ethernet cable, turn off WiFi etc ), the WP7 app can then use cellular data or WiFi on the phone instead.
Alas-
you could set perimeters in your application to Check what the connection type is, then Make changes accordingly.
You May have a slight freeze, but that's better then a crash....mainly when the phone switches from PC to WWAN, their would be a slight Pause.
use the Reachability Class and NSLog to Figure out whats going on exactly.
I really hope that helps!

Windows Phone 7 programming the use of the USB port

I would like to make a Windows Phone 7 application that takes advantage of it's USB port to communicate with the PC. I would like to write an application to control or push information/data to the PC from the application. But I am having problems finding information on where to start. Can anyone help point me in the right direction with some resources?
The only way to communicate over the USB connection is over HTTP.
To get this to work you'll need:
- a webservice hosted on the PC you're connecting to.
- a way for the app (on the phone) to know the hostname of the PC. (You'll probably need to enter it manually)
When you have these it should be straight forward.
You can't.
If you want to make sure to push data to a client PC, you will have to use a kind of synchronization by using the internet. For example create a wp7 application and a desktop application and let them sync the data based on a user object or anything like that.
As far as I know also the updated SDK for Mango will not support programming against the USB dataconnection.

Resources