• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Accessories Gear VR question

A question for any of you who are upgrading or contemplating an upgrade to the Note 10+ who also own a Gear VR headset.

How are you handling the fact that the N10+ won't work with the Gear VR? Are you opting to keep, rather than trade in, your existing smartphone in order to continue using your Gear VR or are you choosing to give up using it?

Just curious.

Help How can I show the time in big numbers while logged-in?

I am using a Motorola 4E+ with Android 7.1.1.

Before I log-in to my phone, the time is displayed in big numbers (~12mm tall) in the middle of my screen.

When I log-in, however, that time display goes away, and instead the time is shown in small numbers (~2mm tall) in the top right corner of the screen. I would like the large time display to remain on the screen. Is there any way to do that?

(Forgive me if this question has been asked before, but I couldn't get this forum's search feature to work at all. It seems completely broken.)

-TC

Passing an object of a Usb Service to another activity

Hello,
I'm new to Android development and I'm attempting to pass an object of a USB service from one activity to another.

I've attempted to do it two ways thus far. Implementing Parcelable and Implementing Serializable. Both means cause the system to throw and exception. In regards to Serializable, it threw an IOException.

Here is the code for my USBService, care of Felhr85.

Code:
package com.ascenzi.usb_serial_testing;

import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbDeviceConnection;
import android.hardware.usb.UsbManager;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
import android.widget.TextView;

import com.felhr.usbserial.CDCSerialDevice;
import com.felhr.usbserial.UsbSerialDevice;
import com.felhr.usbserial.UsbSerialInterface;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

import java.util.HashMap;
import java.util.Map;

//import okio.Buffer;

public class UsbService extends Service implements Serializable
{

    public static final String TAG = "UsbService";

    public static final String ACTION_USB_READY = "com.felhr.connectivityservices.USB_READY";
    public static final String ACTION_USB_ATTACHED = "android.hardware.usb.action.USB_DEVICE_ATTACHED";
    public static final String ACTION_USB_DETACHED = "android.hardware.usb.action.USB_DEVICE_DETACHED";
    public static final String ACTION_USB_NOT_SUPPORTED = "com.felhr.usbservice.USB_NOT_SUPPORTED";
    public static final String ACTION_NO_USB = "com.felhr.usbservice.NO_USB";
    public static final String ACTION_USB_PERMISSION_GRANTED = "com.felhr.usbservice.USB_PERMISSION_GRANTED";
    public static final String ACTION_USB_PERMISSION_NOT_GRANTED = "com.felhr.usbservice.USB_PERMISSION_NOT_GRANTED";
    public static final String ACTION_USB_DISCONNECTED = "com.felhr.usbservice.USB_DISCONNECTED";
    public static final String ACTION_CDC_DRIVER_NOT_WORKING = "com.felhr.connectivityservices.ACTION_CDC_DRIVER_NOT_WORKING";
    public static final String ACTION_USB_DEVICE_NOT_WORKING = "com.felhr.connectivityservices.ACTION_USB_DEVICE_NOT_WORKING";
    public static final int MESSAGE_FROM_SERIAL_PORT = 0;
    public static final int CTS_CHANGE = 1;
    public static final int DSR_CHANGE = 2;
    private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
    private static final int BAUD_RATE = 115200; // BaudRate. Change this value if you need
    public static boolean SERVICE_CONNECTED = false;

    private IBinder binder = new UsbBinder();

    private Context context;
    private Handler mHandler;
    private UsbManager usbManager;
    private UsbDevice device;
    private UsbDeviceConnection connection;
    private UsbSerialDevice serialPort;

    private TextView t1;

    //private Buffer buffer = new Buffer();
    private String mode;

    private boolean serialPortConnected;

    /*
     *  Data received from serial port will be received here. Just populate onReceivedData with your code
     *  In this particular example. byte stream is converted to String and send to UI thread to
     *  be treated there.
     */
    private UsbSerialInterface.UsbReadCallback mCallback = new UsbSerialInterface.UsbReadCallback() {
        @Override
        public void onReceivedData(byte[] arg0) {
            try {
                String data = new String(arg0, "UTF-8");
                if (mHandler != null)
                    mHandler.obtainMessage(MESSAGE_FROM_SERIAL_PORT, data).sendToTarget();
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
    };

    /*
     * State changes in the CTS line will be received here
     */
    private UsbSerialInterface.UsbCTSCallback ctsCallback = new UsbSerialInterface.UsbCTSCallback() {
        @Override
        public void onCTSChanged(boolean state) {
            if(mHandler != null)
                mHandler.obtainMessage(CTS_CHANGE).sendToTarget();
        }
    };

    /*
     * State changes in the DSR line will be received here
     */
    private UsbSerialInterface.UsbDSRCallback dsrCallback = new UsbSerialInterface.UsbDSRCallback() {
        @Override
        public void onDSRChanged(boolean state) {
            if(mHandler != null)
                mHandler.obtainMessage(DSR_CHANGE).sendToTarget();
        }
    };
    /*
     * Different notifications from OS will be received here (USB attached, detached, permission responses...)
     * About BroadcastReceiver: http://developer.android.com/reference/android/content/BroadcastReceiver.html
     */
    private final BroadcastReceiver usbReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            if (arg1.getAction().equals(ACTION_USB_PERMISSION)) {
                boolean granted = arg1.getExtras().getBoolean(UsbManager.EXTRA_PERMISSION_GRANTED);
                if (granted) // User accepted our USB connection. Try to open the device as a serial port
                {
                    Intent intent = new Intent(ACTION_USB_PERMISSION_GRANTED);
                    arg0.sendBroadcast(intent);
                    connection = usbManager.openDevice(device);
                    new ConnectionThread().start();
                } else // User not accepted our USB connection. Send an Intent to the Main Activity
                {
                    Intent intent = new Intent(ACTION_USB_PERMISSION_NOT_GRANTED);
                    arg0.sendBroadcast(intent);
                }
            } else if (arg1.getAction().equals(ACTION_USB_ATTACHED)) {
                if (!serialPortConnected)
                    findSerialPortDevice(); // A USB device has been attached. Try to open it as a Serial port
            } else if (arg1.getAction().equals(ACTION_USB_DETACHED)) {
                // Usb device was disconnected. send an intent to the Main Activity
                Intent intent = new Intent(ACTION_USB_DISCONNECTED);
                arg0.sendBroadcast(intent);
                if (serialPortConnected) {
                    serialPort.close();
                }
                serialPortConnected = false;
            }
        }
    };

    /*
     * onCreate will be executed when service is started. It configures an IntentFilter to listen for
     * incoming Intents (USB ATTACHED, USB DETACHED...) and it tries to open a serial port.
     */
    @Override
    public void onCreate() {
        this.context = this;
        serialPortConnected = false;
        UsbService.SERVICE_CONNECTED = true;
        setFilter();
        usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
        findSerialPortDevice();
    }

    /* MUST READ about services
     * http://developer.android.com/guide/components/services.html
     * http://developer.android.com/guide/components/bound-services.html
     */
    @Override
    public IBinder onBind(Intent intent) {
        return binder;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return Service.START_NOT_STICKY;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        serialPort.close();
        unregisterReceiver(usbReceiver);
        UsbService.SERVICE_CONNECTED = false;
    }

    /*
     * This function will be called from MainActivity to write data through Serial Port
     */
    public void write(byte[] data) {
        if (serialPort != null)
        {
            serialPort.write(data);
        }
    }


    public void setHandler(Handler mHandler) {
        this.mHandler = mHandler;
    }

    private void findSerialPortDevice() {
        // This snippet will try to open the first encountered usb device connected, excluding usb root hubs
        HashMap<String, UsbDevice> usbDevices = usbManager.getDeviceList();
        if (!usbDevices.isEmpty()) {

            // first, dump the hashmap for diagnostic purposes
            for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
                device = entry.getValue();
                Log.d(TAG, String.format("USBDevice.HashMap (vid:pid) (%X:%X)-%b class:%X:%X name:%s",
                                         device.getVendorId(), device.getProductId(),
                                         UsbSerialDevice.isSupported(device),
                                         device.getDeviceClass(), device.getDeviceSubclass(),
                                         device.getDeviceName()));
            }

            for (Map.Entry<String, UsbDevice> entry : usbDevices.entrySet()) {
                device = entry.getValue();
                int deviceVID = device.getVendorId();
                int devicePID = device.getProductId();

//                if (deviceVID != 0x1d6b && (devicePID != 0x0001 && devicePID != 0x0002 && devicePID != 0x0003) && deviceVID != 0x5c6 && devicePID != 0x904c) {
                if (UsbSerialDevice.isSupported(device)) {
                    // There is a supported device connected - request permission to access it.
                    requestUserPermission();
                    break;
                } else {
                    connection = null;
                    device = null;
                }
            }
            if (device==null) {
                // There are no USB devices connected (but usb host were listed). Send an intent to MainActivity.
                Intent intent = new Intent(ACTION_NO_USB);
                sendBroadcast(intent);
            }
        } else {
            Log.d(TAG, "findSerialPortDevice() usbManager returned empty device list." );
            // There is no USB devices connected. Send an intent to MainActivity
            Intent intent = new Intent(ACTION_NO_USB);
            sendBroadcast(intent);
        }
    }

    private void setFilter() {
        IntentFilter filter = new IntentFilter();
        filter.addAction(ACTION_USB_PERMISSION);
        filter.addAction(ACTION_USB_DETACHED);
        filter.addAction(ACTION_USB_ATTACHED);
        registerReceiver(usbReceiver, filter);
    }

    /*
     * Request user permission. The response will be received in the BroadcastReceiver
     */
    private void requestUserPermission() {
        Log.d(TAG, String.format("requestUserPermission(%X:%X)", device.getVendorId(), device.getProductId() ) );
        PendingIntent mPendingIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
        usbManager.requestPermission(device, mPendingIntent);
    }

    public class UsbBinder extends Binder {
        public UsbService getService() {
            return UsbService.this;
        }
    }

    /*
     * A simple thread to open a serial port.
     * Although it should be a fast operation. moving usb operations away from UI thread is a good thing.
     */
    private class ConnectionThread extends Thread {
        @Override
        public void run() {
            serialPort = UsbSerialDevice.createUsbSerialDevice(device, connection);
            if (serialPort != null) {
                if (serialPort.open()) {
                    serialPortConnected = true;
                    serialPort.setBaudRate(BAUD_RATE);
                    serialPort.setDataBits(UsbSerialInterface.DATA_BITS_8);
                    serialPort.setStopBits(UsbSerialInterface.STOP_BITS_1);
                    serialPort.setParity(UsbSerialInterface.PARITY_NONE);
                    /**
                     * Current flow control Options:
                     * UsbSerialInterface.FLOW_CONTROL_OFF
                     * UsbSerialInterface.FLOW_CONTROL_RTS_CTS only for CP2102 and FT232
                     * UsbSerialInterface.FLOW_CONTROL_DSR_DTR only for CP2102 and FT232
                     */
                    serialPort.setFlowControl(UsbSerialInterface.FLOW_CONTROL_OFF);
                    serialPort.read(mCallback);
                    serialPort.getCTS(ctsCallback);
                    serialPort.getDSR(dsrCallback);

                    //
                    // Some Arduinos would need some sleep because firmware wait some time to know whether a new sketch is going
                    // to be uploaded or not
                    //Thread.sleep(2000); // sleep some. YMMV with different chips.

                    // Everything went as expected. Send an intent to MainActivity
                    Intent intent = new Intent(ACTION_USB_READY);
                    context.sendBroadcast(intent);
                } else {
                    // Serial port could not be opened, maybe an I/O error or if CDC driver was chosen, it does not really fit
                    // Send an Intent to Main Activity
                    if (serialPort instanceof CDCSerialDevice) {
                        Intent intent = new Intent(ACTION_CDC_DRIVER_NOT_WORKING);
                        context.sendBroadcast(intent);
                    } else {
                        Intent intent = new Intent(ACTION_USB_DEVICE_NOT_WORKING);
                        context.sendBroadcast(intent);
                    }
                }
            } else {
                // No driver for given device, even generic CDC driver could not be loaded
                Intent intent = new Intent(ACTION_USB_NOT_SUPPORTED);
                context.sendBroadcast(intent);
            }
        }
    }
}

. When I attempt to pass the Object itself I do the following.

Code:
private UsbService usbService;
...
Button swchBtn = (Button) findViewById(R.id.buttonSwitch);
        swchBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick (View v)
            {

                if(usbService != null)
                {
                    Intent swIntent = new Intent(MainActivity.this, SecondActivity.class);
                    swIntent.putExtra("USBService", usbService);
                    startActivity(swIntent);
                }
            }

before I switch activities I have done a quick check to make sure that it wasn't equal to "null". I'll change it up later and say if it is equal to null then I'll jump over but I won't send a intent extra. But for now it just crashes every time.

Any insight?

Michael

disc drive diagnostic tool

hey guys i have a hard drive and a few flash drives I got from eBay that appear to be modded, so i want an app that can run a good diagnostic test to find errors then fix them, Also have a good format tool, perderably one that can restore it to its original state, since im using a android tv box otg Isn't a issue, I've done lots research and so far everything I have found either costs money or just doesn't do what I want, or possibly I don't know how to use it, there was one app that I think can format drives but my box doesn't like it so it just crashes im not at home but I know it says silkat tools or something like that

Rusted/missing dishwasher prongs

What can I do about them? They're probably not helping the dishes get done right. Also, the upper basket or whatever it's called is not sliding right. It's getting stuck and maybe coming off the track. The slides sometimes stick out more than they should and I have to push them back by hand. All things considered, I can see why ge discontinued the nautilus.

How do I delete the 'Me' entry in Phone Contacts list?

I use a Samsung Galaxy Note 8, running Android V9.

After temporarily trying a new SIM PAYG card and then reverting to my original Vodafone contract SIM, I noticed that when I now tap the Phone icon and then select 'Contacts' from the row of options at the bottom of the screen (Keypad, Recents, Contacts, Voicemail, Places) there is a new entry at the top of the list. It' appears under the heading of 'Me' and lists the number of the now-removed SIM.

For some unknown reason, the temporary SIM installation generated this Me category of contact, but reinstalling the original SIM did not modify that contact to use the correct number.

I would like to completely delete this invalid 'Me' entry, but so far, I have failed to find any way to do this. Any assistance would be much appreciated.

Read NTFS usb drive?

I dont recall having this problem with my old phone, but I also haven't pulled it out and tried the usb memory drives I've tried in the S-10+.

Phone wants to format the drive in order to use it. From some reading, it looks like it will format the drive to Fat32.

Thing is, I want usb drives to float between the PC and the S-10+ and I am reading that Windows 10 has issues reading FAT32 drives. I'm about to upgrade to a Windows 10 PC at some point.

Is it true that modern androids and modern Windows PCs dont read the same file format? New Windows is NTFS format but Android is only FAT32?

There is this file manager app but a lot of people are saying it's a sucker app that gets you on the hook and makes you pay for every step and format. I dont mind paying for an app I know will work if its not going to poison my phone with junk and ads, but these so-called "free" apps that are only really free to download really aggravate me. Tell me up front what I need to pay to make the app work without ads and dont waste my time. I cant stand a bait ans switch and thats what most apps seem to be.

Any knowledge about this is appreciated. I dont plan to do a lot of usb transfer/use at this time but the phone came with an adapter, so I just plugged a usb flash or thumb or whatever those sticks are called in to it to see if it worked and found this issue.

Android Auto

My husband and I have the Google Pixel Xl 3. I use the Android Auto but he doesn't and he drives for his job. I've tried to disable it for him, force stop etc. cause he hates when he wakes up his phone it's there after he's been driving. Is there anyway to stop it from popping back up or reactivating? I've shown how to just swype it away and continue to do what he was going to but he doesn't want to be bothered with it.

GOOGLE PLAY - ERROR

This morning I went to check if there were any apps I needed to update and I keep getting a message saying Error checking for updates, no apps show below it, nothing showing under the installed tab. I was going to disable it but it says it might not work properly same with force stop.

Send UDP from Application

Hello ,
I'm new at android\java so be patient :)

I want to create a small application that send a udp string to my server when I press the button.
everything is working - but it doesn't seem to send
this is what I have

btnAction.setOnClickListener(new View.OnClickListener() {
@ override
public void onClick(View v) {

try {

String messageStr = "test!";
int server_port = 1111;
DatagramSocket s = new DatagramSocket();
InetAddress local = InetAddress.getByName("My.Public.Server.IP");
int msg_length = messageStr.length();
byte[] message = messageStr.getBytes();
DatagramPacket p = new DatagramPacket(message, msg_length, local,server_port);
s.send(p);
}
catch (Exception e) {

}



}
}

whant could be the reason for it?

Thanks ,

Help Google play stuck and wechat issue

I have 2 samsung s10 +, one is working well, but another has issues.

2 weird issues: google play store and wechat, they always stop working at same time.

on play store, it stucks at 99% at most time.sometimes stuck at 30% or pending dowbloading.
everytime when play store is not working, wechat will stop receiving msg video calls. when someone trid to call me by using wechat, i cannot get any notification or ring, after the other party hang up i immediately received call cancel notification. and after 20 mins or so, i got ring and notification there is video call.
Samsung service center has replaced the PBA, same issue. every time manufacture can resolve the issue for an hour or 2, and then issue returned. :( so fraustrating...

Help Getting google calendar to see hotmail calendar on 10+

We had a note 3 and 4 and now have the 10+. The wife had been using google calendar on her old phone and wants to continue to do so on the note 10 but for the LIFE of me I cannot figure out how to get this google calendar app to see her hotmail calendar. I've got the outlook app configured for her email but she hates the calendar that comes with it. I have desperately tried to add her hotmail account to accounts under general settings but it claims it already exists so it cant be added and of course is never seen to be added under google's calendar as a result

Can someone save my sanity?

Accessories Samsung Galaxy Note 10+ Headphones

Hi everyone, I just got my Samsung Galaxy Note 10+ 512 GB. And I am loving it!! Great phone. I have a question, the wired headphones that came with the phone are the AKG USB-C Earbud headphones. Does anyone know where I can get another pair? No one seems to have these exact headphones. I don't want the wireless ones. I want the ones like these: see below link. Can anyone help. Thank you.

https://www.google.com/url?sa=i&sou...aw32sC7KQ1qjbQYYFaBSq9gg&ust=1567104720228456

Malware search bar at bottom of screen?

Hi. I have a Google Pixel 3 which I bought fairly recently. I have started to notice that a search bar named "search for Chevy truck" pops up at the bottom of my screen intermittently. Sometimes, it happens while I'm typing on my keyboard and end up accidentally pressing it, as it usually pops up over my spacebar button. I'm quite sure this is some kind of a malware that was wondering if you guys can help me find a way to remove this.

What keyboard are you using for everyday text input?

I've tried both the Samsung stock keyboard and Google's Gboard.

Of the 2, I prefer Google's.

I can press a button to switch between writing and typing. However, it doesnt automatically start handwriting mode when the S-Pen is pulled out. Samsung's Keyboard does.

The pen strokes in Google seem heavier than in Samsung's, in this respect, I prefer samsung, and in Samsung's it's a 2 button press to switch keyboards, here Google wins. Also in Google's fawow is that it doesn't convert the text as quick as Samsung The text also shifts left in Google and up in Samsung.

Either I have yet to find it, or neither have a ruled page theme to write over.

Do any of you use a keyboard other then Samsung's or Google's?

I've made a small video showing how to turn on handwriting, if you are not sure how to:

Filter

Back
Top Bottom