Privet Rustam,

Cellular data connections are managed automatically. Some phones (HTC) have a setting for keeping a data connection at all times. Others establish the data connection on demand.

WiFi connections are established whenever a configured ("known") network is within range.

So in your service, you can just connect and it should just work.

The only exception is when your service wakes up the phone from sleep, and WiFi is enabled by the user. If there is a network within range, Android will connect, but it might take a few seconds, because WiFi radio is usually disabled when the phone sleeps.

If you wanted to make your service really smooth (and save users some money), you could detect this, and delay your network operations until the WiFi subsystem is done connecting (you can monitor broadcast actions from ConnectivityManager or WifiManager for this). A few seconds should be enough. Remember to acquire a wake lock, so the device doesn't fall asleep while you're waiting for a connection.

-- Kostya

28.11.2010 15:20, Rustam Kovhaev ?????:
Hi thanks, will check that

regarding the first question, just want to make it absolutely clear
lets consider following situation:
on my Android cell I have 3g connection available(not connected, there is difference), if my App Service(background) needs Internet connection would it or would it not ask user's permission to connect to network?


2010/11/28 akkilis <[email protected] <mailto:[email protected]>>

    Rustam,

    To stop all the data connections while working on emulator,
    you need to configure it through DDMS perspective.

    Open it and go to "Telephony Section",
    There you will find a drop down for the "Data" services,
    choose appropriate option for your requirement from "home", "roaming"
    and "denied".

    I dint get what you want to ask in the first query.
    If there is any open or public network available to your phone, it
    will connect to it automatically,
    provided you have not activated "airplane" mode.

    First you need to connect your phone to any working network,
    then only your app can also make any remote connection.


    --
    You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    [email protected]
    <mailto:[email protected]>
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:android-developers%[email protected]>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en




--
Regards,
Rustam Kovhaev
http://libertadtech.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to