logo
down
shadow

Is it possible to use of Mobile data while transferring file via Wi-Fi Direct?


Is it possible to use of Mobile data while transferring file via Wi-Fi Direct?

By : James Matthew
Date : October 15 2020, 08:10 AM
I think the issue was by ths following , In the Android Operating System, the OS uses MobileData if and only if the device is not connected to any WiFi network. In the phone default configuration, WIFI priority is higher than the data traffic, which is from the perspective of customer service to save money,
WIFI is free most of the time, and data traffic is never free of cost, So whether the operating system or mobile APP in the WIFI and data traffic are turned on at the same time will give priority to the use of WIFI without the use of data traffic
code :


Share : facebook icon twitter icon
Connecting multiple devices and transferring data through Wifi Direct without access point

Connecting multiple devices and transferring data through Wifi Direct without access point


By : user3555356
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Currently on android in wifi-direct, you can only create one-to-many connections (which includes one-to-one). In these connections one guy will become the group owner and other will connect to it. The guy who connected to the group owner cannot be part of another group (though its not explicitly mentioned anywhere, just like you I did my R&D when I was building an app using wifi-direct).
I do not think currently it is possible on android, so there won't be any SDKs available for this. This and connection troubles is one of the major reasons you won't find many apps on Play Store using wifi-direct.
issues with one to many mobile device file transfer in android using wifi direct

issues with one to many mobile device file transfer in android using wifi direct


By : Coding Moneky
Date : March 29 2020, 07:55 AM
should help you out Hotspot uses hidden methods which are invoked using Reflection. Essentially, hotspot is an access point to which other people can connect as they connect to normal wifi networks.
As told above it is an access point, hence they are two major functions one needs to support
code :
/**
     * Start AccessPoint mode with the specified
     * configuration. If the radio is already running in
     * AP mode, update the new configuration
     * Note that starting in access point mode disables station
     * mode operation
     * @param wifiConfig SSID, security and channel details as part of WifiConfiguration
     * @return {@code true} if the operation succeeds, {@code false} otherwise
     */
    public boolean setWifiApEnabled(WifiConfiguration wifiConfig, boolean enabled) {
        try {
            if (enabled) { // disable WiFi in any case
                mWifiManager.setWifiEnabled(false);
            }

            Method method = mWifiManager.getClass().getMethod("setWifiApEnabled", WifiConfiguration.class, boolean.class);
            return (Boolean) method.invoke(mWifiManager, wifiConfig, enabled);
        } catch (Exception e) {
            Log.e(this.getClass().toString(), "", e);
            return false;
        }
    }
WifiConfiguration wifiCon = new WifiConfiguration();
wifiCon.SSID = "ssid";
wifiCon.preSharedKey = "password";
wifiCon.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
wifiCon.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
wifiCon.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
wifiCon.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
try
{
    Method setWifiApMethod = wm.getClass().getMethod("setWifiApEnabled", WifiConfiguration.class, boolean.class);
    boolean apstatus=(Boolean) setWifiApMethod.invoke(wm, wifiCon,true);
} 
catch (Exception e) 
{
    Log.e(this.getClass().toString(), "", e);
}
public Boolean connectToHotspot(WifiManager wifiManager, String ssid) 
    {
        this.wifiManager = wifiManager;
        WifiConfiguration wc = new WifiConfiguration();
        wc.SSID = "\"" +encodeSSID(ssid) +"\"";
        wc.preSharedKey  = "\"" + generatePassword(new StringBuffer(ssid).reverse().toString())  +  "\"";
        wifiManager.addNetwork(wc);
        List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
        for( WifiConfiguration i : list ) {
            if(i!=null && i.SSID != null && i.SSID.equals(wc.SSID)) 
            {
                 wifiManager.disconnect();
                 boolean status = wifiManager.enableNetwork(i.networkId, true);
                 wifiManager.reconnect();               
                 return status;
            }
         }
        return false;
    }
/**
     * Gets a list of the clients connected to the Hotspot, reachable timeout is 300
     * @param onlyReachables {@code false} if the list should contain unreachable (probably disconnected) clients, {@code true} otherwise
     * @param finishListener, Interface called when the scan method finishes
     */
    public void getClientList(boolean onlyReachables, FinishScanListener finishListener) {
        getClientList(onlyReachables, 300, finishListener );
    }
/**
 * Gets a list of the clients connected to the Hotspot 
 * @param onlyReachables {@code false} if the list should contain unreachable (probably disconnected) clients, {@code true} otherwise
 * @param reachableTimeout Reachable Timout in miliseconds
 * @param finishListener, Interface called when the scan method finishes 
 */

public void getClientList(final boolean onlyReachables, final int reachableTimeout, final FinishScanListener finishListener) {

Runnable runnable = new Runnable() {
    public void run() {

        BufferedReader br = null;
        final ArrayList<String> resultIPAddr = new ArrayList<String>();

        try {
            br = new BufferedReader(new FileReader("/proc/net/arp"));
            String line;
            while ((line = br.readLine()) != null) {
                String[] splitted = line.split(" +");

                if ((splitted != null) && (splitted.length >= 4)) {
                    // Basic sanity check
                    String mac = splitted[3];

                    if (mac.matches("..:..:..:..:..:..")) {
                        boolean isReachable = InetAddress.getByName(splitted[0]).isReachable(reachableTimeout);

                        if (!onlyReachables || isReachable) {
                            resultIPAddr.add(splitted[0]);
                        }
                    }
                }
            }
        } catch (Exception e) {
            Log.e(this.getClass().toString(), e.toString());
        } finally {
            try {
                br.close();
            } catch (IOException e) {
                Log.e(this.getClass().toString(), e.getMessage());
            }
        }

        // Get a handler that can be used to post to the main thread
        Handler mainHandler = new Handler(context.getMainLooper());
        Runnable myRunnable = new Runnable() {
            @Override
            public void run() {
                finishListener.onFinishScan(result);
            }
        };
        mainHandler.post(myRunnable);
    }
};

Thread mythread = new Thread(runnable);
mythread.start();
}
//This can be done by getting WifiManager's instance from the System.

WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
wifiManager.getScanResults();

// The above is an async call and will results are available System will broadcast `SCAN_RESULTS_AVAILABLE` intent and you need to set a `BroadCastReceiver` for it.

// And get the results like this 

List<ScanResult> results = wifiManager.getScanResults();
USB cable Detection and Data transferring from Mobile to PC

USB cable Detection and Data transferring from Mobile to PC


By : Saumya Srivastava
Date : March 29 2020, 07:55 AM
it helps some times How to detect the USB connection in android device and transfer data from android device to PC using USB cable ? in advance
code :
This code is working which can automatically detect when usb is connected and disconnected..

 Receiver:

import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.graphics.Color;
    import android.util.Log;
    import android.view.Gravity;
    import android.widget.TextView;
    import android.widget.Toast;

    public class DetactUSB extends BroadcastReceiver
    {
    private static final String TAG = "DetactUSB";
    @Override
    public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub
        if(intent.getExtras().getBoolean("connected"))
        {
        TextView textView = new TextView(context);
        textView.setBackgroundColor(Color.MAGENTA);
        textView.setTextColor(Color.BLUE);
        textView.setPadding(10,10,10,10);
        textView.setText("USB connected..........");
        Toast toastView = new Toast(context);
        toastView.setDuration(Toast.LENGTH_SHORT);
        toastView.setGravity(Gravity.CENTER, 0,0);
        toastView.setView(textView);
        toastView.show();
        }
        else{


             TextView textView = new TextView(context);
                textView.setBackgroundColor(Color.BLUE);
                textView.setTextColor(Color.YELLOW);
                textView.setPadding(10,10,10,10);
                textView.setText("USB not connected..........");
                Toast toastView = new Toast(context);
                toastView.setDuration(Toast.LENGTH_SHORT);
                toastView.setGravity(Gravity.CENTER, 0,0);
                toastView.setView(textView);
                toastView.show();
        }



    }
    }

manifest: 

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.usbdetectiondemo"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.INTERNET" >
    </uses-permission>
    <uses-permission android:name="android.permission.RECORD_AUDIO" >
    </uses-permission>


    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name=".DetactUSB" >
            <intent-filter>

                  <action android:name="android.hardware.usb.action.USB_STATE" />

            </intent-filter>
        </receiver>
    </application>

</manifest>


And There is no need to do any thing in the activity..
To create xml file inside the direct of the project of my mobile XAMARIN

To create xml file inside the direct of the project of my mobile XAMARIN


By : Bri
Date : March 29 2020, 07:55 AM
will be helpful for those in need I want to create an xml file inside the directory of my project, so also create a command where I can edit and subscribe it. How can I increment this in my project in a simple and basic way?
code :
var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
var filename = Path.Combine(path, "inicio.xml");
rss.Save(filename);
jQuery mobile subpage (data-role='page') not as a direct child of body

jQuery mobile subpage (data-role='page') not as a direct child of body


By : Alejandro Perez Albi
Date : March 29 2020, 07:55 AM
With these it helps Are you using a plugin to do this?
Because Jquery Mobile by default only loads the contents of the FIRST div-data-role-page via Ajax. Unless it's your first page, which should be loaded completely. Everything else (head, scripts, your container.class will not be loaded.
Related Posts Related Posts :
  • How to set epoch in Firestore using server time
  • Android 8 Geofences on killed app
  • When I Try to Change the Color of SnackBar TextView App Crashes
  • cannot access outer class variable for datasnapshot.haschild() method
  • Cannot read image written to file
  • Databinding seems to be broken after adding Room
  • switch statement Error : Statement must be prepended with case label
  • View local firebase database with Stheto on Android
  • How to employ keyed-hash message authentication code (HMAC) with Android Keystore
  • Prevent inviting existing users or previously invited
  • How to overwrite windowSoftInputMode using edit-config tag in cordova
  • Difference between Loader and AsyncTask
  • In Firebase Android, retrieve the value of a child node and save it in a boolean variable
  • when i scroll the custom list in my android app then the favorite icon which is part of the custom adapter changes on it
  • adding room dependency gives manifest merge error
  • Visibility of RelativeLayout change on scrolling Gridview
  • Strange LiveData behavior vs ObservableField
  • Which layout is used for clash of clans home screen? We can scroll it horizontal as well as vertical. Please illuminate
  • RxJava: Know when observable is finished and return Boolean Observable to the caller
  • how to use savedInstanceState to save camera information when the orientation change occure
  • Style React-Native via Styles.xml
  • Keyboard won't show after calling InputMethodManager.showSoftInput
  • Compiling ffmpeg for Android on OSX
  • Button does not get clicked on the first attempt
  • AR Core performance, learning curve and comparison with other frameworks
  • Codename one : Attaching images to email message fails
  • Error: Unsupported type 'viewItem' in Android build
  • setLayoutParams on ConstraintLayout does not change size
  • How to profile the fetch time of the android gradle libraries
  • Kotlin setOnclickListener
  • Naming convention for methods returning RxJava's Completable
  • Conv3D not working
  • FFmpeg audio video merge command
  • Do you have to use gradle-experimental for JNI?
  • How to get key hashes for facebook for facebook app?
  • ZXing not calling onActivityResult, When scanning QR Code
  • Integration of Android Native module with existing Xamarin Native Project
  • Restore RecyclerView state after rotating
  • ViewModelProviders java.lang.RuntimeException trying to instantiate class which inherit AndroidViewModel
  • SKD19 vs SDK24 - Usage of API documented as @since 1.8+
  • filter option in list view fragment activity
  • Picture from camera not showing up in second activity
  • How to change imageview according to screen size
  • How to copy Android Studio project to remote Git (NOT GitHub) server
  • How to get React-Native to announce specific accessibility message via AccessibiliyManager?
  • Change colors of com.tech.freak.wizardpager.ui.StepPagerStrip
  • Android fullscreen activity shows ActionBar
  • Turn on the screen when timer calls onFinish()
  • Would like a bit of clarification with SQLite database's onUpgrade method
  • Use ObjectBox with Libgdx
  • How to make combine Gregorian and Hijri calendar in Android?
  • Try to read text file from sdcard in other language
  • "App not installed" message when installed apk
  • How to execute a designated test suite class in Firebase Test Lab
  • play music with background service
  • background not visible on LG G3
  • should every View have an id?
  • Realm object server sync on low connection.
  • Correct way to add more views to adapter
  • Getting error in android support library
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org