Is it possible to activate ionic app on call - ionic-framework

I am not sure it is possible in ionic or not. What i want to do is create an app that can record user calls. so app must be activate when user make or get a call.
can anyone tell me if it is possible, how to do this?

Beware this won't be an easy task but "never give up, never surrender". You'll want to use a variation of techniques first off this isn't an Ionic thing as much as it is a PhoneGap thing - ionic runs on phonegap.
Your workflow will look something like this:
User opens your app sees a list of contacts
(the formatted names of contacts are different for android & ios so be prepared to test for this.
http://ngcordova.com/docs/plugins/contacts/)
Contacts are displayed in ion-list user select one and phone's dialer launches (use href=tel:xxxxx)
From there you're going to want to trigger the audio capture plugin's API
https://github.com/apache/cordova-plugin-media-capture
To add the plugin to your project:
cordova plugin add cordova-plugin-media-capture
While it doesn't directly say it can record in call conversations it should still work.
It can definitely be done the storage space is also of concern, you'll have to set something in place to tell the user how many seconds/minutes they have the capacity to store.
That should get you started there will certainly be unforeseen nuances.
Good luck.

We can record calls with cordova-media-plugin plugin in android.
First install the media Plugin by executing the following command
cordova plugin add cordova-plugin-media
Then goto the Plugin folder and traverse into the following file “plugins\cordova-plugin-media\src\android\AudioPlayer.java” . Here in the startRecording function we have line
this.recorder.setAudioSource(MediaRecorder.AudioSource.MIC); line number is 154
Change it to this.recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
We can replace MIC with any audio source in the following link. for example VOICE_COMMUNICATION,VOICE_DOWNLINK,VOICE_RECOGNITION etc
https://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html

Related

Can Flutter application function in the background?

I am new to flutter.
I want to build a map application that shows collectable items on a map. When the users are near the item they can collect them. I have to make call to server to indicate that user collect the item.
I understand the application will function when it is in the foreground. But if the application is in the background can it perform these functions? For example: update users location, get items based on the location, collect items etc.
Does flutter can perform these functions normally if it is in the background or we have to create say some service type of application to do this?
I appreciate any advice regarding this.
Yes, you can do it, but you will need to create this methods with kotlin / java and use the platform channels to invoke it.
Yes you can workmanger is for running something on the background in your flutter app and it supports dart directly Workmanager. Alternatively native code will work for you swift or objective-c for ios and kotlin or java for android depending on which default native languages you tell flutter to create project with but that becomes very complex especially over ios side if you have no prior experience. Try your best with workmanager see if that can work.
Put a look to firebase schedule functions and cron as well see if they can do the job as well for you
Firebase Schedule Functions
Cron Flutter

Geo-location in Ionic 2

I'm working on Ionic app, which should show users on the map by their current geo-location.
For example, User 1 can turn on GPS, and other Users can see him on
the map after opening a MapComponent. For example, GeoService can fetch current data of the Users's location, on safe it frequently in db (once a minute, for example), and other users, when open MapComponent, can fetch all of data from db collection, and see the Points on the map.
What plugins should I use, or tutorials to archive it? How to get access of the GPS location. How to enable and disable it?
Ionic Native will be a life saver for you.
Ionic Native is a TypeScript wrapper for Cordova/PhoneGap plugins that make adding any native functionality you need to your Ionic mobile app easy.
Geolocation
Depending on how accurate you want the geolocation ping to be and how energy you want it to use you can either go for Background Geolocation (cheap) or Geolocation.
Map Component
In order to display a map with markers on it you should use the Google Maps plugin.
Local Data Cache
You will probably also need a way to cache locally any data you get from the backend (or anything else). The best and easiest way to go about it is using ionic-storage.
Developing using native cordova plugins
In any case, since all these APIs are operating on top of Cordova, you should only test this functionality in an actual device or in an emulator. Of course when geolocation is involved, you cannot go run around the block each time you make a code change so I strongly advise you to mock these plugins during development.

How can I run automated tests that support real iOS devices, take screenshots, and identify controls by ID?

I need to run some automated UI checks on our native iPhone app. I'd like to be able to do the following:
I'd like to automate a few actions and take screen shots.
I don't want the tool to identify the buttons by image or text, as my app changes images and text all the time. I'd like to identify controls by ID.
I'd like to run these tests on a real iPhone device.
Lastly, when I complete one test, I need to access to settings to modify a few changes, then relaunch app to test. (no need to resume the app)
Is there a good way to achieve these kinds of automated UI tests?
You can use the instrument that apple provides - UIAutomation
It provides all expected automation facilities. Screenshots can also be taken. Check for documentation here apple doc
Here is a nice tutorial to start with http://cocoamanifest.net/articles/2011/05/uiautomation-an-introduction.html

Setting a Recurring Event using Appcelerator Titanium

I've got an app I'm building using Appcelerator Titanium that will be a combination alarm clock/url fetcher. The part I'm having problem with is that I need to be able to set a time for the app to go fetch the url and then perform actions as necessary (in this case alert the user if data that should be entered in a time system has been entered). I also want it to do this every day (or every week day) at the prescribed time, and I want it to not have to be 'launched' every time. I'd rather it come up and run as a service, or at least run as a service when sent to the background. I'm most focused on the iPhone, but I've got a few Android users that would like it as well.
Is it even possible to have an Appcelerator app hooked into the system like that? If so, are there any tutorials or examples? I can't even find an alarm clock example, which scares me a bit.
I think that localNotifications should work for you.
there is a sample in the bg.js file included in the kitchenSink.
It is also helpful to know that all of the keys/properties available to you are documented here in the source code.
This guy has a nice alarm module written for android.
https://github.com/benbahrenburg/benCoding.AlarmManager

Opening one app from another app without closing the app

In the home page of my iphone app, there is a button added. When that button is clicked some other iphone app needs to be opened in a new viewcontroller (with out closing the parent app).There will be a back button on this view controller. When the back button is clicked, the new viewcontroller which is showing the another app needs to be closed and our parent app's home page needs to be shown.
Please give me some ideas on how to do this. I googled for this i didnt get any solutions.
Thanks,
Raja.
-- the following applies to iOS versions previous than 4.0 :)
Actually, there can be only one iPhone application running at once (with exceptions of Safari, Phone and some other system applications). The iPhone Human Interface Guidelines say so:
Only one iPhone application can run at a time, and third-party applications never run in the background. This means that when users switch to another application, answer the phone, or check their email, the application they were using quits.
However, if you only need to e.g. show a webpage, you can do it using UIWebView
Also, if you need to open another application, you should use URLs as pointed by Steve Harrison. This will, however, close your application. The recommended behavior in this case is to remember your application state and restore it when the application is run again, as Nithin writes.
According to apples documentation, they are not allowing any applications to be run in the background, except system generated ones. So you will be unable to do the thing you are going to implement. However, there is one thing that can make the same result.
You told that you are calling other application to run on a button click. Before initiating that application, save the current state of your application, may be using sqlite3 or core-data, and then open the other one. While returning back, load the pre-saved data from the database or wherever you have stored it. Every time you start the application, you check for the persisted data, if exists, load it or otherwise load your basic view
I don't think that you can run other iPhone apps within your own one. It doesn't make sense. You can open another iPhone app via a URL (see here and here), but this will close your app.
Like it has been stated: running two apps is not allowed by apple. You can however implement this apps features into you're app and have both get and save data to the same server...
Or like Nithin said: this functionality is available on JB iphones. Look into "backgrounder" for implementing one solution for normal users and one for thouse that has jailbroken.