Giter Club home page Giter Club logo

Comments (12)

jumaallan avatar jumaallan commented on September 26, 2024 1

@Idomo
Hi Ido,
Sorry for the mix up. Now this Repo is in my Personnal Github Account. I got some interested guys who wanted to to be part of the small Open Source Community I wanted to start, and then I created the organization (AndroidStudyOpenSource) - More like a Github Page for my blog. I wanted to open source a couple of Android and Golang projects there.
The Tovuti library has been delayed for a while, I switched jobs and this has made me dedicate more time to my new job, and other stuff. Its not published on JCenter, thats why its missing from gradle. At the moment, just use this Repo, version 0.0.2. In a week's time, I will make sure I finish up on Tovuti and publish it.
I wanted to have this library move over to the organization for easy and efficient collaborations and contributions. I will send you an invite to join the same, and make those kick-ass contributions.
We will have to probably look at that error you are getting and update this project as it is the one that works at the moment.
Cheers Man!

from androidnetworkmanager.

jumaallan avatar jumaallan commented on September 26, 2024 1

@Idomo
I now get what you are saying. Sorry I took too long to understand you, just create a pull request and update the Readme. That would be very nice of you :) 👍

from androidnetworkmanager.

Idomo avatar Idomo commented on September 26, 2024 1

@jumaallan
Done ;)

from androidnetworkmanager.

Idomo avatar Idomo commented on September 26, 2024

@jumaallan
Thanks for the quick replay!
I'm not sure that what I wrote is a bug (about the monitor method), I'm just not sure if the library stop itself like you planed to do here: #5 or that it's keep running also when the activity has been destroyed.
The question is: Should I call the Tovuti in all my activities or should I call it only in my MainActivity (the first activity) and it will keep listen to the connectivity changes?

from androidnetworkmanager.

jumaallan avatar jumaallan commented on September 26, 2024

@Idomo
You should only use it when you want to check internet connection status. Make sure you override onStop and stop Tovuti.

@OverRide
protected void onStop() {
super.onStop();
tovuti.stop();
}

To make sure Tovuti stops when you stop the activity, because Monitor keeps running, and may result to crashes. Look at the sample code on the README Page

from androidnetworkmanager.

Idomo avatar Idomo commented on September 26, 2024

@jumaallan
This is the problem I wrote here, I can't use the class as you described in the README page because the monitor method return void and not Tovuti object, this is a static class, I can't create an instance of it.

from androidnetworkmanager.

jumaallan avatar jumaallan commented on September 26, 2024

@Idomo
Could you share your code repo or create a github gist?

from androidnetworkmanager.

Idomo avatar Idomo commented on September 26, 2024

@jumaallan

Tovuti.from(context).monitor(new Monitor.ConnectivityListener(){
    @Override
    public void onConnectivityChanged(int connectionType, boolean isConnected, boolean isFast){
       // Handle connection...
    }
});

I copied the code from the README page (with the private property and onStop method) and then Android Studio told me that I can't put this in the property because it returns void, then I checked the source code and find thats true, there are tow method of monitor and they return void:

public void monitor(int connectionType, Monitor.ConnectivityListener listener) {
    Context context = contextRef.get();
    if (context != null)
        monitors.add(new DefaultMonitorFactory().create(context, connectionType, listener));
    start();
}

public void monitor(Monitor.ConnectivityListener listener) {
    monitor(-1, listener);
}

from androidnetworkmanager.

jumaallan avatar jumaallan commented on September 26, 2024

@Idomo
It checks to make sure context is not null, then creates a Monitor, which implements an interface to monitor the connection. Could you pull/clone this repository and test it? It works well in a couple of projects I have been working on.

Tovuti.from(this).monitor(new Monitor.ConnectivityListener() {
@OverRide
public void onConnectivityChanged(int connectionType, boolean isConnected, boolean isFast) {

        }
    });

This snippet works for Activities. Are you calling it from an Activity or Fragment?

from androidnetworkmanager.

Idomo avatar Idomo commented on September 26, 2024

@jumaallan
If you'll look here https://github.com/AndroidStudyOpenSource/tovuti/blob/master/tovuti/src/main/java/com/androidstudy/tovuti/Tovuti.java#L40
you can see that the monitor methods return Tovuti object, what allow me to save it and use it later for onStop method, in this project (version 0.0.2) the methods are return void so I don't have access to the object (unless I call Tovuti.from() to get the object, but you didn't mention it in the README page) and I can't call it in onStop.

And yes, I call it in activity, if I'll call it from fragment I'll need activity context? What is the context I should use so it will work fine for sure? AppCompatActivity?

from androidnetworkmanager.

jumaallan avatar jumaallan commented on September 26, 2024

@Idomo
You need to call Tovuti.from() to get the object, as you are saying. Yes
Kindly update the Readme, and add yourself as part of the Authors. I will be glad to merge it
Thanks

from androidnetworkmanager.

jumaallan avatar jumaallan commented on September 26, 2024

@Idomo
I have merged the pull request. I have also invited you as a collaborator in the repo - check your email and feel free to make more contributions.
You can mark this issue as resolved, if its okay.

from androidnetworkmanager.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.