Comments (6)
expected as code wasn't tested.
will try to solve communication error as soon as i get the device.
@jithinbp I took reference from your comm. library and https://github.com/mik3y/usb-serial-for-android.
from pslab-android.
@viveksb007 I think the Androidmanifest.xml should be configured to notify the app when PSLab is attached.
The intent filter needs to be declared
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
from pslab-android.
@akarshan96 yea, I remember using those to automatically launch the App when the device was connected. Another way would be to ask for permission when the app is launched. The following code was used by the MainMenuActivity in the Android app for ExpEYES
private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
private PendingIntent mPermissionIntent;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_menu);
setTitle("ExpEYES Experiments ( Connect... )");
mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
filter = new IntentFilter(ACTION_USB_PERMISSION);
registerReceiver(mUsbReceiver, filter);
mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
mcp2200 = new devhandler(mUsbManager);
if(mcp2200.device_found )mUsbManager.requestPermission(mcp2200.mDevice, mPermissionIntent);
else Toast.makeText(getBaseContext(),"No device connected. check connections.",Toast.LENGTH_SHORT).show();
ej=expeyesCommon.getInstance();
}
from pslab-android.
Look for
/*---------------------REQUEST USB PERMISSION WITHIN THE APPLICATION--------------------------*/
from pslab-android.
@jithinbp yes, we have to define a onReceive method under BroadcastReceiver. I am working on it. Hope it resolve errors
from pslab-android.
@akarshan96 this onReceive method is for explicitly asking for permission when there are more than one device connected.
Using an intent filter should solve the issue.
Reference : https://developer.android.com/guide/topics/connectivity/usb/host.html#permission-d
from pslab-android.
Related Issues (20)
- Wave Generator: layout not really usable in horizontal orientation HOT 3
- Wave Generator: Buttons next to seekbar have no effect HOT 1
- Wave Generator: unit of phase is lost after orientation change
- Wave Generator: value for phase offset is set on orientation change, even if user has entered none
- Output waveform of the In-Built-MIC cuts after a certain value
- Wave Generator: seekbar inactive on start of screen even though Freq-button is active HOT 3
- Wave Generator: two buttons for the value of the seekbar can be selected at the same time
- Wave Generator: phase cannot be selected for first waveform HOT 5
- Oscilloscope: Layout not usable on some screen sizes
- Oscilloscope: Add new feature for Instrument Run Control
- Automate the process of updating version name and version code
- Oscilloscope: Add new feature for Position Controls HOT 2
- Oscilloscope: Add new feature for Auto-Scale
- Oscilloscope: Graph doesn't clear after deselecting the In-Built MIC HOT 1
- OutOfMemoryError on older devices
- Navigation bar appears in fullscreen mode in Oscilloscope and Logic Analyzer
- Use hidden color map in pin layout screens
- Enhance the Auto-Scale feature for Noise Detection HOT 5
- Analogue waveform not generated correctly if digital waveform is used at the same time HOT 3
- PSLab v6 can't communicate with the Android device HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pslab-android.