Is it possible to make a Cordova app use a custom subclass of CordovaActivity?
This question was originally about detecting arbitrary key events in a Cordova app. But now I think this is impossible for the same reason it's impossible to receive key events in a Service. However, I'm thinking that if I could extend CordovaActivity, I could override the onKey... methods and broadcast something on the LocalBroadcastManager, which could be received by a plugin.
I'm trying to capture the KEYCODE_HEADSETHOOK that is generated from an audio jack phone handset. We tried listening for the onkey... events in JavaScript. No dice. Since neither CordovaActivity nor CordovaWebView overrides any of the onKey... methods, I don't know if or how the JavaScript receives any key events at all.
According to an "Official Rep" in the PhoneGap community forums, this was not possible as of July 2012.
Related
I been trying to figure out how to stream mic data from the android to flutter. I found some example code on how to query mic in chucks but I do not know a way to get the data onto flutter.
https://github.com/bitplane/Microphone/blob/master/src/net/bitplane/android/microphone/MicrophoneService.java
I am not sure which classes to look in flutter
https://docs.flutter.io/flutter/services/EventChannel/receiveBroadcastStream.html
I wonder if anyone can help me point to the right direction.
I been digging through example plugins in flutter github and found this.
https://github.com/flutter/plugins/tree/master/packages/sensors
Unfortunately for me, EventChannel documentation is sparse. I do not believe we can pass streams from flutter to the platform so I can replay whatever I recorded in a feedback loop.
Event callback. Supports dual use: Producers of events to be sent to Flutter act as clients of this interface for sending events. Consumers of events sent from Flutter implement this interface for handling received events (the latter facility has not been implemented yet).
https://docs.flutter.io/javadoc/io/flutter/plugin/common/EventChannel.EventSink.html
The process is similar to creating a methodchannel, but I need to create an onCancel and onListen in android. Within the onListen, I must create also listener that could receive events. If I want to create audio events, I must use setPositionNotificationPeriod(int) and OnRecordPositionUpdateListener(listener).
https://developer.android.com/reference/android/media/AudioRecord.html
https://github.com/flutter/plugins/blob/master/packages/sensors/android/src/main/java/io/flutter/plugins/sensors/SensorsPlugin.java
On flutter I must create a broadcast stream event
https://github.com/flutter/plugins/blob/master/packages/sensors/lib/sensors.dart
I manage to write my own terrible plugin that is android only atm. If anyone needs it I wonder what permissive license I should add
https://github.com/hungrymonkey/mic_stream
What is the official API in Qt5.2 (which started supporting Android and iOS officially) for sending text messages? or generally the Messaging API.
Currently Qt mostly work for GUI only stuff on Android. To be able to do what you want you have to call Java code from C++. I suggest you start of by extending QtActivity (and call super on the functions already implemented like onCreate() etc.). Then you would have to code using the Android SMS Manager class.
More information and an example on how to call Java code from C++/Qt can be found here.
This should get you started if you decide to proceed.
I want to intercept incoming call in android.
One way is to extend "BroadcastReceiver". Is there any other way?
Also, does "BroadcastReceiver" works on all andorid versions? See this link - How to intercept incoming calls android 2.3.x
Yes Broadcast Receiver works in all versions. Please refer http://developer.android.com/reference/android/content/BroadcastReceiver.html. It is available since version 1 (i.e. from the start of Android).
I used PhoneStateListener (http://developer.android.com/reference/android/telephony/PhoneStateListener.html) . It is also available since version 1.
How is it possible to modify and extend the Sencha Touch 2 Native Packaging for Android (see http://docs.sencha.com/touch/2-0/#!/guide/native_android)? I want to add a Push functionality to the Android Project.
IMO, you should use cordova(phonegap). With that, you'll get plugins to add push in your app. As far as I know, there's no way you can use PUSH with Sencha Touch itself. To work with Push you must have a device id. Sencha can not give you that (unless you manage to call functions inside your activity from javascript). Moreover, you need to have a broadcast receiver set up to listen to incoming push messages. Basically, there's bunch of to-do's involved in using Push, so you can not simply automate that job and let native packaging do it.
Modifying/extending sencha tools native packaging is not simply worth it considering time and efforts that would take (if possible).
You should check out http://www.pubnub.com/ they have Javascript client to do listen to a queue and using that you can extecute whatever you want once message is pushed.
I am developing an application in android for device usage profiling and analysis where I have to read features from the android OS.
For example i have to read
outgoing_calls
outgoings_calls_to_non_contacts (un-saved numbers)
outgoing_sms
outgoings_sms_to_non_contacts (un-saved numbers)
Keyboard_related readings (pressure, key_dwell_time, key_flight_time etc)
delete_key_use_rate
average_transition_left_right
average_transition_right_left
touch_screen_pressure
What will be the way to accomplish this? i.e what libraries from SDK do I have to use.
Any example for reading these values will be very helpful.
Kind Regards
Khurram
Your Application should have Broadcast Receivers. And Register Various Intents.
For Ex : Outgoing Call : android.intent.action.NEW_OUTGOING_CALL and android.intent.action.PHONE_STATE.
For Outgoing Messages : Detecting SMS incoming and outgoing
For Keyboard related I am not sure , How to do that :)
Because of security/privacy issues not all of these values are available for standard android programs. The only way I know to achieve this, is to root the device and attach yourself to the system services you need. If you only want to analyse the usage of your own application you have to write a subclass for each class which is a direct or indirect subclass of View and overwrite the onTouchEvent, onKeyPressed, onClick... events and extends these classes in your application.