Giter Site home page Giter Site logo

adroitandroid / near Goto Github PK

View Code? Open in Web Editor NEW
347.0 19.0 92.0 2.42 MB

A P2P library for Android for discovery on local networks using UDP and transfer in general using TCP sockets

Home Page: https://goo.gl/kioAiQ

License: MIT License

Java 3.50% Kotlin 96.50%
p2p discovery transfers p2p-library android peer transfer

near's People

Contributors

adroitandroid avatar datl4g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

near's Issues

IllegalArgumentException when I exit

I ran your example and when I exit the app this error appears:

    java.lang.RuntimeException: Unable to start service com.adroitandroid.near.discovery.client.UdpBroadcastService@73c0f23 with null: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter intent
        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3449)
        at android.app.ActivityThread.-wrap21(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1633)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6316)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
     Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter intent
        at com.adroitandroid.near.discovery.client.UdpBroadcastService.onStartCommand(UdpBroadcastService.kt)
        at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3432)
        at android.app.ActivityThread.-wrap21(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1633) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6316) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) 

This happens on android 7, on android 10 everything is ok. I need some help. Thanks

Can makeDiscoverable by service like NSD?

I have a lot of devices and I want to group them by service, can you do it?
ex:
makeDiscoverable (String hostName, String serviceName);

makeDiscoverable ("My android device", "printer.tcp");

Look for devices that have the "printer.tcp" service registered instead of searching for them all
startDiscovery ("printer.tcp")

Out Of Memory

Hello,

I have this error sometimes.

Fatal Exception: java.lang.OutOfMemoryError: pthread_create (stack size 16384 bytes) failed: Try again
at java.lang.VMThread.create(VMThread.java)
at java.lang.Thread.start(Thread.java:1029)
at com.adroitandroid.near.connect.TcpServerService.onNewReceive(TcpServerService.java:131)
at com.adroitandroid.near.connect.TcpServerService.access$300(TcpServerService.java:25)
at com.adroitandroid.near.connect.TcpServerService$1$1.run(TcpServerService.java:81)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)

File sharing

This library is awesome, I was stuck creating a P2P chat with no middle servers and any other softwares, it never worked with sockets, it was a huge problem, also I was using NSD for device discovery, it works really bad. This library save me, the discovery is very fast and the chat was easy to integrate on my app.
I would like to know if it stills on development, the last commit was on July so I'm not sure of what's gonna happen now. I have to add file sharing on my app so I need to know if we will have it on Near.

Stop after mServerSocket!!.accept()

Hii, I am just creating a demo exactly like yours.
But I got an issue with the socket object.
Every time it stops in the startServer method(val connectionSocket = mServerSocket!!.accept()) and it display "Collecting data" in debuging.
Capture
Capture1

Add the possibilities to have many instances of NearConnect

Hello,
As you marked in your doc, it would be nice to be able to have several instances of NearConnect, it would allow to have a instance of scan and another communication, like that if two clients communicate together, a third can come join them

Thank you

Peers update

Hello,

I make a long scan (many hours) and the ping is every 5000ms.
Sometimes i have 0 peers connected sometimes 1 and that chnage evry 2-3 times ping.
What are the possibilities that occur ?

Thank's

Crashes app after going to background

OnPause of my activity I do:

    if (nearDiscovery.isDiscovering) {
      nearDiscovery.stopDiscovery()
    }
    if (nearDiscovery.isDiscoverable) {
      nearDiscovery.makeNonDiscoverable()
    }
    if (nearConnect.isReceiving) {
      nearConnect.stopReceiving(false)
    }

but still it crashes with this error:

java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter intent         at com.adroitandroid.near.connect.server.TcpServerService.onStartCommand(TcpServerService.kt)

Video call support

hi thanks for amazing library

i wonder if we can add p2p video call support to it , it will be very good

thanks

Pure Java Equivalent

I need a pure Java equivalent for Desktop applications
But I'm running into some problems implementing this
(especially implementing the server)

It would be very cool if you took care of it and created a repository for it.
I would of course also help as much as possible if it is difficult in terms of time.

java.lang.NoClassDefFoundError

java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/text/Regex;
what is the cause for this error?

Code is below
mNearDiscovery = new NearDiscovery.Builder()
.setContext(this)
.setDiscoverableTimeoutMillis(60000)
.setDiscoveryTimeoutMillis(60000)
.setDiscoverablePingIntervalMillis(1000)
.setDiscoveryListener(getNearDiscoveryListener(), Looper.getMainLooper())

            .build();
    mNearDiscovery.makeDiscoverable("Abcd","");

>2 devices and host/peer setup

Hi there,

Firstly, thank you for the fantastic job you've done with this API! It's made P2P vastly simpler and cleaner for me. I would like to make use of the API for a project I am working on - notably, a game involving up to 5 devices, with one 'host' device and four peer users. The peer users will need to send data to the host, and the host will have to send data out to all peer users.

I have seen the API used effectively in your sample app for two-way communication - for more users, is it as simple as opening up the discovery process again on a designated 'host' device? I.e. can one device maintain active connections with multiple devices and be able to send out messages that are picked up by them all?

Thanks!

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.