RxWifiP2pManager


Source link: https://github.com/mrmitew/RxWifiP2pManager

RxWifiP2pManager (DEPRECATED)

A library allowing you to manage Wi-Fi peer-to-peer connectivity in a reactive way. The library itself is a RxJava wrapper for Android's WifiP2pManager, used for discovering available peers, setup connection to peers and query for the list of peers.

When a p2p connection is formed over wifi, devices continue to maintain the uplink connection over mobile or any other available network for internet connectivity. For more information, please refer to https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.html

Requirements

Min sdk is API level 14.

Some examples

Instantiation of RxWifiP2pManager

mRxWifiP2pManager = new RxWifiP2pManager(

 getApplicationContext(),

 (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE),

 new WifiP2pBroadcastObservableManagerFactory(getApplicationContext()));

Request current p2p peers

mRxWifiP2pManager.requestPeers()

  .subscribeOn(Schedulers.computation())

  .observeOn(AndroidSchedulers.mainThread())

  .subscribe(wifiP2pDevice -> Log.d("log", "Device found: " + wifiP2pDevice.deviceName));

Discover and request all nearby p2p peers

mRxWifiP2pManager.discoverAndRequestPeers()

  .timeout(5, TimeUnit.SECONDS) // Optional, but recommended

  .subscribeOn(Schedulers.computation())

  .observeOn(AndroidSchedulers.mainThread())

  .subscribe(wifiP2pDevice -> Log.d("log", "Device found: " + wifiP2pDevice.deviceName));

Discover and request a list with all current nearby p2p peers

mRxWifiP2pManager.discoverAndRequestPeersList()

  .timeout(5, TimeUnit.SECONDS) // Optional, but recommended

  .subscribeOn(Schedulers.computation())

  .observeOn(AndroidSchedulers.mainThread())

  .subscribe(wifiP2pDeviceList -> Log.d("log", Arrays.toString(wifiP2pDeviceList.getDeviceList().toArray())));

Initiation of a peer discovery

mRxWifiP2pManager.discoverPeers()

  .subscribeOn(Schedulers.computation())

  .observeOn(AndroidSchedulers.mainThread())

  .subscribe(() -> Log.d("log", "Discover completed"));

Initiation of a connection request to a peer

mRxWifiP2pManager.connect(mRxWifiP2pManager.createConfig("<mac address>", WpsInfo.PBC))

  .subscribeOn(Schedulers.computation())

  .observeOn(AndroidSchedulers.mainThread())

  .subscribe(() -> Log.d("log", "Connected"));

Requesting information about the current connection

mRxWifiP2pManager.requestConnectionInfo()

  .subscribeOn(Schedulers.computation())

  .observeOn(AndroidSchedulers.mainThread())

  .subscribe(wifiP2pInfo -> Log.d("log", wifiP2pInfo.toString()));

Remove an existing p2p group

mRxWifiP2pManager.disconnect()

  .subscribeOn(Schedulers.computation())

  .observeOn(AndroidSchedulers.mainThread())

  .subscribe(() -> Log.d("log", "Disconnected"));

To-do

Not all APIs from Android's WifiP2pManager are included into this library, so this is something to do for a future release. PRs are welcome! :)

Sample app

Demonstrates several of the RxWifiP2pManager's APIs, including:

  • discovering nearby p2p devices
  • connecting to a device
  • requesting/displaying connection information
  • disconnect from an existing p2p group

You can either build it yourself or download it from the Google Play Store: https://play.google.com/store/apps/details?id=com.stetcho.rxwifip2pmanager.app

Screenshots

Dependencies

Sample app

dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'])
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {

exclude group: 'com.android.support', module: 'support-annotations'
  
}
)
  compile 'com.android.support:appcompat-v7:25.0.0'
  compile 'com.android.support:design:25.0.0'
  testCompile 'junit:junit:4.12'

debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
  releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
  testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'

compile project(":library")

// SVG lib
  compile 'com.pixplicity.sharp:library:1.0.2@aar'

// Butterknife
  compile 'com.jakewharton:butterknife:8.1.0'
  apt 'com.jakewharton:butterknife-compiler:8.1.0'

// RxJava
  compile "io.reactivex:rxjava:1.2.1"
  compile "io.reactivex:rxandroid:1.2.1" 
}

Library

dependencies {

  compile fileTree(dir: 'libs', include: ['*.jar'])
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {

exclude group: 'com.android.support', module: 'support-annotations'
  
}
)
  testCompile 'junit:junit:4.12'

// RxJava
  compile "io.reactivex:rxjava:1.2.1"

// RxBroadcast
  compile 'com.cantrowitz:rxbroadcast:1.1.0' 
}

Build

$ git clone https://github.com/mrmitew/RxWifiP2pManager.git $ cd rxwifip2pmanager/ $ ./gradlew build

Communication

  • Author: Stefan Mitev
  • E-mail: mr.mitew [at] gmail . com
  • Github issues

Bugs and Feedback

For bugs, questions and discussions please use the Github issues.

Changelog

1.0.1

  • Use the newest version of LeakCanary (1.5)
  • Added a custom launcher icon

1.0.0

  • Initial version

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Resources

Client of iComet server for Java/Android iComet server This project is based the iComet service

Simply, this project is an implements of client for iComet service. You can use it in your java project as well as Android project.

When you apply the plugin and install an app all debug version icons will have flavor, build type and version name.

This library is design to insert cursor row inside another cursor or insert dummy row inside actual cursor.

MathFu is a C++ math library developed primarily for games focused on simplicity and efficiency.

It provides a suite of vector, matrix and quaternion classes to perform basic geometry suitable for game developers. This functionality can be used to construct geometry for graphics libraries like OpenGL or perform calculations for animation or physics systems.

Simple and smooth PDF viewer for Android applications. This project use copy of MuPDF as library module.

Android sample project with Material Design and toolbar. Project uses Appcompat library for material design.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes