Connection without ConnectivityManager

98 views
Skip to first unread message

Termana

unread,
Aug 11, 2010, 8:20:14 PM8/11/10
to android-porting
Hi,
I have a platform which at the moment receives an internet connection
by non-standard means. Web browser and other network things work fine.
However, because the connection is being received in a non-standard
way (not by wifi or RILD), it does not get registered with the
ConnectivityManager. This is a problem because many apps (including
built-in ones - like when downloading something through the browser)
will query the ConnectivityManager to see if a network connection is
active. If not, it won't proceed with the related network activity
(eg. download).

Is there a way I can fake a connection in connectivitymanager
(register a connection thats not there for example), so that the
ConnectivityManager will report that some sort of connection is
available?

Are there any other ways around this? How does the emulator handle it,
since it gets it's connection through the host computer?

Cheers,
Bradley Smith

Robert Greenwalt

unread,
Aug 11, 2010, 8:54:07 PM8/11/10
to bradley...@gmail.com, android-porting
I wouldn't call if "faking" a connection, but you should probably extend the NetworkStateTracker and create a new NetworkType, then modify ConnectivityService to instantiate your NST subclass for your network type.  What version of android are you using - this changed a bunch in the eclair timeframe I think.  Also, if you can say, what type of network is this?  If it's generally useful it may be a nice opensource submission!

Thanks
Robert

Termana

unread,
Aug 11, 2010, 10:16:29 PM8/11/10
to android-porting

On Aug 12, 9:54 am, Robert Greenwalt <rgreenw...@google.com> wrote:
>  What version of android are you using - this changed a bunch in the eclair
> timeframe I think.
I'm using Froyo (2.2)

> Also, if you can say, what type of network is this?  If
> it's generally useful it may be a nice opensource submission!

I am apart of the effort to get Android working on the Nokia N900
(NITdroid). It has a 3G modem, but doesn't communicate with AT
commands, and (obviously) does not have a RIL shared library written
for it. It is a GPRS (on UMTS) connection. However instead of writing
a RIL that will communicate with phonet (which is a network interface
that communicates with the phonet/isi modem, and has its own
protocol), and having to learn how to communicate directly over it, at
the moment we are working on making Android work with ofono (including
at some point writing a RIL that will communicate with ofono using d-
bus).

The modem is powered and network registered by ofono, and when you
start the data connection it gives you a network interface - gprs0.
(And then you make sure the gprs0 interface is configured (eg.
ifconfig gprs0 gprs.ip.address.here) and add a default route in the ip
tables - route add default dev gprs0)

When we make ofono communicate with RILD, this will obviously not
matter - so I was just looking for a temporary solution while this is
happening - since it is quite annoying have a lot of apps (including
built-in ones) refuse to work properly because the ConnectivityManager
reports no connection.

> Thanks
> Robert

Cheers,
Bradley Smith

Robert Greenwalt

unread,
Aug 12, 2010, 1:40:52 PM8/12/10
to bradley...@gmail.com, android-porting
Excellent!  That sounds like a fun project.

I would recommend going the NetworkStateTracker route.  It should get notified of state changes for your modem and convert that into standard signals for the ConnectivityService.  It also provides an API for the ConnectivityService to turn your modem on and off.  Currently the 3g connection is assumed to turn itself on at boot - but post boot it would be controlled by the ConnectivityService.

Regards
Robert


Cheers,
Bradley Smith

Tom

unread,
Sep 21, 2010, 6:38:54 AM9/21/10
to android...@googlegroups.com
Robert Greenwalt <rgreenwalt@...> writes:

>
>
> Excellent!  That sounds like a fun project.
>
> I would recommend going the NetworkStateTracker route.  
It should get notified
of state changes for your modem and convert that into
standard signals for the
ConnectivityService.  It also provides an API for the
ConnectivityService to
turn your modem on and off.  Currently the 3g connection
is assumed to turn
itself on at boot - but post boot it would be controlled
by the ConnectivityService.
>
> Regards

> RobertOn Wed, Aug 11, 2010 at 7:16 PM, Termana


Something similar has been done to add ethernet support to Android here:

http://tinyurl.com/23t25ot

Let us know how you get on. The results may be useful in solving this
issue:

http://forum.xda-developers.com/showthread.php?p=8236341

Thanks

Reply all
Reply to author
Forward
0 new messages